Skip to content

[lex.key] p1 The tokens have already been determined in phase 6 #855

@xmh0511

Description

@xmh0511

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

[lex.key] p1 says

The identifiers shown in Table 5 are reserved for use as keywords (that is, they are unconditionally treated as keywords in phase 7) except in an attribute-token ([dcl.attr.grammar]).

Phase 7 is [lex.phases] 1.7, which says

The tokens constitute a translation unit and are syntactically and semantically analyzed as a translation-unit ([basic.link]) and translated.

However, before phase 7, phase 6 already says

Each preprocessing token is converted into a token ([lex.token]).

A token([lex.token] p1) is one of them

There are five kinds of tokens: identifiers, keywords, literals, operators, and other separators.

This means that, after converting an identifier that was previously a preprocessing token to a token, it is either an identifier or a keyword, which phase is before phase 7. An identifier that has already been determined as a keyword in phase 6 cannot be used where the syntax expects an identifier in phase 7.

Suggested Resolution:

In phase 6, the identifiers in Table 5 have already been determined as keywords, which is before phase 7. Saying these identifiers are keywords in phase 6 is more reasonable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions