Title
Restrictions on character sequences in header-names
Status
open
Section
5.6 [lex.header]
Submitter
Richard Smith

Created on 2025-03-26.00:00:00 last changed 7 days ago

Messages

Date: 2025-03-15.00:00:00

Additional notes (March, 2025)

The new wording removes the permission for implementations to yield an error when a header-name contains ", \, or ' in a __has_include.

Date: 2025-03-26.20:59:25

Suggested resolution:

Change in 5.6 [lex.header] as follows:

The appearance of either of the characters ' or \ or of either of the character sequences /* or // in a q-char-sequence or an h-char-sequence is conditionally-supported with implementation-defined semantics, as is the appearance of the character " in an h-char-sequence. [Note 2: As specified in 15.3 [cpp.include] and 15.4 [cpp.embed], which header, source file, or resource is identified by a header-name, if any, is implementation-defined. Thus, a sequence of characters that resembles an escape sequence can result in an error, be interpreted as the character corresponding to the escape sequence, or have a completely different meaning, depending on the implementation. However, a " character cannot appear in an q-char-sequence, and a > character cannot appear in a h-char-sequence, even if preceded by a \ character.end note]
Date: 2025-03-26.00:00:00

Subclause 5.6 [lex.header] specifies implementation-defined behavior for certain character sequences appearing in header-names. This is redundant with the implementation-defined searches specified in 15.3 [cpp.include] and 15.4.1 [cpp.embed.gen], which already cover recognition of \ escape sequences and similar implementation deviations.

History
Date User Action Args
2025-03-26 21:05:31adminsetmessages: + msg8010
2025-03-26 19:25:32adminsetmessages: + msg8008
2025-03-26 00:00:00admincreate