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

2025-10-11


3077. Undesirable formation of import directive with string-literal

Section: 15.1  [cpp.pre]     Status: tentatively ready     Submitter: Hubert Tong     Date: 2025-09-22

(From submission #769.)

Consider:

  #define STR(X) #X
  const char *str = STR(
  import u8"hello";     // #1
  );

Line #1 is recognized as an import directive, even though the eventual attempt to form a header-name will be IFNDR (see issue 3076). This is incongruent with the stated design goal of P1857: since a header-name is lexed right away, any string-literals that remain are necessarily invalid.

Proposed resolution (approved by CWG 2025-09-26):

Change in 15.1 [cpp.pre] bullet 1.2 as follows: