summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/compound-literal.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-05-16 11:45:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-05-16 11:45:48 +0000
commit0b4af8f7554d8ae782fbd9e92a6d4211e8c95c2a (patch)
treeaf7500e64aa19393c7e7475db881534a99a3d138 /clang/test/Sema/compound-literal.c
parent18bb9284fffb62977647bffaf0bd5fec17241751 (diff)
downloadbcm5719-llvm-0b4af8f7554d8ae782fbd9e92a6d4211e8c95c2a.tar.gz
bcm5719-llvm-0b4af8f7554d8ae782fbd9e92a6d4211e8c95c2a.zip
PR3009: Get rid of bogus warning for scalar compound literals.
This patch isn't quite ideal in that it eliminates the warning for constructs like "int a = {1};", where the braces are in fact redundant. However, that would have required a bunch of refactoring, and it's much less likely to cause confusion compared to redundant nested braces. llvm-svn: 71939
Diffstat (limited to 'clang/test/Sema/compound-literal.c')
-rw-r--r--clang/test/Sema/compound-literal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/Sema/compound-literal.c b/clang/test/Sema/compound-literal.c
index 24ec223ae6a..b51bcfe2a23 100644
--- a/clang/test/Sema/compound-literal.c
+++ b/clang/test/Sema/compound-literal.c
@@ -6,7 +6,7 @@ static struct foo t = (struct foo){0,0};
static struct foo t2 = {0,0};
static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
static int *p = (int []){2,4};
-static int x = (int){1}; // -expected-warning{{braces around scalar initializer}}
+static int x = (int){1};
static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'char [2]', expected 'long'}}
OpenPOWER on IntegriCloud