cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[cpp.import] What is the exact different between the header-name and header-name-tokens #455

Open xmh0511 opened 11 months ago

xmh0511 commented 11 months ago

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[cpp.import] p4 says

Additionally, in the second form of pp-import, a header-name token is formed as if the header-name-tokens were the pp-tokens of a #include directive. The header-name-tokens are replaced by the header-name token.

What is the case that the tokens in header-name-tokens cannot be represented by a header-name?

header-name:

  • < h-char-sequence >
  • " q-char-sequence "

header-name-tokens

  • string-literal
  • < h-pp-tokens >

It seems that all token sequences represented by < h-pp-tokens > can be represented by < h-char-sequence >, except that string-literal can represent more than a " q-char-sequence "(e.g. addition encoding-prefix, or a raw-string).

The standard does not specify what the case will match the form export opt import header-name-tokens pp-tokens opt ; new-line rather than export opt import header-name pp-tokens opt ; new-line