Skip to content

CWG3142 [cpp.predefined] Binary integer literal and digit separators for __LINE__ #826

Description

@frederick-vs-ja

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

Reference (section label): [cpp.predefined]

Link to reflector thread (if any):

Issue description:

Discovered in cplusplus/draft#8584 (comment).

It's possible to static_assert that __LINE__ expands to a literal of expected forms since C++11 (example), or assert this at run time even in ancient C++98. And then in C++14, we introduced binary integer literals and digit separators, which allows __LINE__ to expand to a literal of a formerly unexpected form.

As a result, if an implementation switch to use the new forms of integer literals for __LINE__, some valid C++11 program may become ill-formed or have behavior changed.

Should there be an Annex C entry for this, or should we restrict the forms for __LINE__?

Suggested resolution:

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