diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-01 21:06:14 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-01 21:06:14 +0000 |
commit | cecf184e64befbd160d7d0b42b2a10c7853f19f0 (patch) | |
tree | 929ea863dfba7166d4c9107c5082849ff64e163c /clang/test/Sema/const-eval.c | |
parent | 1f1f2d8ca39f038e6f6d52771efe62b319efcdb2 (diff) | |
download | bcm5719-llvm-cecf184e64befbd160d7d0b42b2a10c7853f19f0.tar.gz bcm5719-llvm-cecf184e64befbd160d7d0b42b2a10c7853f19f0.zip |
When constant-folding, don't look at the initializer of a global const variable
if it's marked as weak: that definition may not end up being used.
llvm-svn: 143496
Diffstat (limited to 'clang/test/Sema/const-eval.c')
-rw-r--r-- | clang/test/Sema/const-eval.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c index df56b06e48c..c984f5bf840 100644 --- a/clang/test/Sema/const-eval.c +++ b/clang/test/Sema/const-eval.c @@ -95,3 +95,7 @@ int intLvalue[*(int*)((long)&n ?: 1)] = { 1, 2 }; // expected-error {{variable l union u { int a; char b[4]; }; char c = ((union u)(123456)).b[0]; // expected-error {{not a compile-time constant}} + +extern const int weak_int __attribute__((weak)); +const int weak_int = 42; +int weak_int_test = weak_int; // expected-error {{not a compile-time constant}} |