diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-25 21:59:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-25 21:59:05 +0000 |
commit | c71d08bc22ae12755afb4d65bc33852e4dba7355 (patch) | |
tree | 057f1041e843c726e8da5b13b7d96b7969bf894a /clang/test | |
parent | 4c73d7a9b804e12dbb2d41d63cfe96b2b9ec6cf2 (diff) | |
download | bcm5719-llvm-c71d08bc22ae12755afb4d65bc33852e4dba7355.tar.gz bcm5719-llvm-c71d08bc22ae12755afb4d65bc33852e4dba7355.zip |
fix PR4073 by making designated initializer checking code use
VerifyIntegerConstantExpression instead of isIntegerConstantExpr.
This makes it ext-warn but tolerate things that fold to a constant
but that are not valid i-c-e's.
There must be a bug in the i-c-e computation though, because it
doesn't catch this case even with pedantic.
This also switches the later code to use EvaluateAsInt which is
simpler and handles everything that evaluate does.
llvm-svn: 70081
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/designated-initializers.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Sema/designated-initializers.c b/clang/test/Sema/designated-initializers.c index 309a5304598..3333122202a 100644 --- a/clang/test/Sema/designated-initializers.c +++ b/clang/test/Sema/designated-initializers.c @@ -221,3 +221,14 @@ struct Enigma enigma = { &c0, .float_ptr = &f0 // expected-warning{{overrides}} }; + + +/// PR4073 +/// Should use evaluate to fold aggressively and emit a warning if not an ice. +extern int crazy_x; + +int crazy_Y[] = { + [ 0 ? crazy_x : 4] = 1 +}; + + |