llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

-Wunreachable-code warning not issued when a macro is used

Open riyazvp opened this issue 8 years ago • 2 comments

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

riyazvp avatar Apr 12 '18 22:04 riyazvp

Reproducible with clang 18.1.0 : https://godbolt.org/z/nr9d9Y8bq

JOE1994 avatar May 14 '24 14:05 JOE1994

This issue is a side-effect of https://github.com/llvm/llvm-project/commit/1b7f49c2d6072f3e1432877a5e78ca946845bd2c

JOE1994 avatar May 14 '24 16:05 JOE1994