Skip to content

Clang not diagnosing invalid literals in subexpressions within a preprocessor conditional #134658

Closed
@kyuupichan

Description

@kyuupichan

I cannot find anything that permits a compiler to accept the following (in either the C or C++ standards). Integer literals must have a type and a value in range for that type:

#if 0? 999999999999999999999999999999999999: 3
#endif

Clang accepts it even with -pedantic-errors. It seems that GCC, EDG and MSVC all reject it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions