Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unexpected error when passing a type to an unidentified preprocessor definition #140057

Copy link
Copy link
Open
@Anthony-Nicholls

Description

@Anthony-Nicholls
Issue body actions

Given the following code...

class T{};

void f()
{
    UNDEFINED_MACRO (T);
}

https://godbolt.org/z/5WjGM4KE6

we might expect an error regarding the undeclared identifier UNDEFINED_MACRO however, in this specific case we get 'T' does not refer to a value.

If we change the code to so that it passes a variable instead of a type, for example...

void f()
{
    int i;
    UNDEFINED_MACRO (i);
}

https://godbolt.org/z/YT1GGPG4Y

then the error is the more expected use of undeclared identifier 'UNDEFINED_MACRO'.

gcc and MSVC both appear to error as we might expect in this scenario.

I've tested this using trunk on CompilerExplorer as linked above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.