Issue 140057
Summary Unexpected error when passing a type to an unidentified preprocessor definition
Labels new issue
Assignees
Reporter Anthony-Nicholls
    Given the following code...

```cpp
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...

```cpp
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to