llvm-project
llvm-project copied to clipboard
-Wunreachable-code warning not issued when a macro is used
| Bugzilla Link | 37117 |
| Version | 6.0 |
| OS | All |
| CC | @firewave |
Extended Description
Reported by Martin Galvin on cfe-dev:
This code triggers the warning:
int main() { return 0;
int a = 42;
}
while this doesn't:
#define A 42
int main() { return 0;
int a = A;
}
This happens on clang++-6.0. I'm not using any options other than -Wunreachable-code
Reproducible with clang 18.1.0 : https://godbolt.org/z/nr9d9Y8bq
This issue is a side-effect of https://github.com/llvm/llvm-project/commit/1b7f49c2d6072f3e1432877a5e78ca946845bd2c