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 | 65ac598c7ba7e36f2ad611f2bb39cc957053be5d (patch) | |
tree | 35e0864095caae7e184da77a337799d827b64f17 /test/Sema/const-eval.c | |
parent | 344d78d6a669fb324f89937fc0739f97670f4700 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143496 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/const-eval.c')
-rw-r--r-- | test/Sema/const-eval.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index df56b06e48..c984f5bf84 100644 --- a/test/Sema/const-eval.c +++ b/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}} |