From c71d08bc22ae12755afb4d65bc33852e4dba7355 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 25 Apr 2009 21:59:05 +0000 Subject: 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 --- clang/test/Sema/designated-initializers.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'clang/test/Sema/designated-initializers.c') 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 +}; + + -- cgit v1.2.3