Skip to content

CWG3077 [cpp.pre] Forming import _string-literal_ directives not desirable #769

Description

@hubert-reinterpretcast

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

Reference (section label): [cpp.pre]

Link to reflector thread (if any): N/A

Issue description:

https://wg21.link/cpp.pre#1.2 triggers import directive recognition for

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

Such an import directive invariably leads to IFNDR (see #768). The stated goal of https://wg21.link/p1857 is to "[fine-tune] the context-sensitivity of import [ ... ]". The string-literal provision for triggering import directive recognition at the start of phase 4 is not consistent with such an intent: since header-name‌s are directly formed in this context, the only string-literal‌s seen will lead to IFNDR.

Suggested resolution:

Strike in https://wg21.link/cpp.pre#1.2:

  • an import preprocessing token immediately followed on the same logical source line by a header-name, <, identifier, string-literal, or : preprocessing token, or

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions