Title
Prefer header-name over user-defined-string-literal
Status
open
Section
5.5 [lex.pptoken]
Submitter
Richard Smith

Created on 2026-06-24.00:00:00 last changed 6 days ago

Messages

Date: 2026-06-25.21:44:41

Suggested resolution:

Change in 5.5 [lex.pptoken] bullet 5.4.1 as follows:

  • ...
  • Otherwise, the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token, even if that would cause further lexical analysis to fail, except that
    • a string-literal or user-defined-string-literal token is never formed when a header-name token can be formed, and
    • a header-name (5.6 [lex.header]) is only formed ...
Date: 2026-06-24.00:00:00

Consider:

  #define SUFFIX
  #include "foo.h"SUFFIX

The "foo.h" should be lexed as a header-name, not as a user-defined-string-literal.

History
Date User Action Args
2026-06-25 21:44:41adminsetmessages: + msg8614
2026-06-24 00:00:00admincreate