This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


3126. A module import needs a header-name as a token

Section: 5.10  [lex.token]     Status: tentatively ready     Submitter: Hubert Tong     Date: 2025-11-18

(From submission #812.)

Consider:

  import "myheader.h";

The (phase 7) grammar module-import-declaration (10.3 [module.import]) expects a header-name, but that is not a valid token per 5.10 [lex.token].

Proposed resolution (approved by CWG 2025-12-05):

  1. Change in 5.5 [lex.pptoken] paragraph 2 as follows:

    Each preprocessing token that is converted to a token (5.10 [lex.token]) shall have the lexical form of a keyword, an identifier, a literal, a header name, or an operator or punctuator.
  2. Change in 5.10 [lex.token] as follows:

      token:
         identifier
         keyword
         literal
         header-name
         operator-or-punctuator
    
    There are five six kinds of tokens: identifiers, keywords, literals [ Footnote: ... ], header names, operators, and other separators. ...