Title
Add example for ill-formed non-preprocessing tokens
Status
tentatively ready
Section
5.5 [lex.pptoken]
Submitter
CA

Created on 2025-10-02.00:00:00 last changed 1 week ago

Messages

Date: 2026-04-29.21:28:40

Proposed resolution (approved by CWG 2026-04-28):

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

... If a U+0027 apostrophe, a U+0022 quotation mark, or any character not in the basic character set matches the last category, the program is ill-formed.

[ Example:

  # if 0
  #<U+3000>else // error: non-basic character 
  int x;
  # endif

The notion <U+3000> in this example represents the character U+3000 IDEOGRAPHIC SPACE.

-- end example]

Date: 2025-10-02.00:00:00
N5028 comment CA 022

Consider:

  # if 0
  #<U+3000>else // ill-formed, diagnostic required
  int x;
  # endif

(where <U+3000> represents U+3000 IDEOGRAPHIC SPACE). This is ill-formed per 5.5 [lex.pptoken] paragraph 1:

... If a U+0027 apostrophe, a U+0022 quotation mark, or any character not in the basic character set matches the last category, the program is ill-formed.

This rule could benefit from an example in the standard.

History
Date User Action Args
2026-04-29 21:28:40adminsetstatus: open -> tentatively ready
2026-04-18 15:33:44adminsetmessages: + msg8543
2025-10-02 00:00:00admincreate