summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/compound-literal.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-01-09 20:58:06 +0000
committerSteve Naroff <snaroff@apple.com>2008-01-09 20:58:06 +0000
commit08ddb8c55cba887f7c09da896a0982d7a60efc37 (patch)
treef33a09b08b70f5c1166dbe84120a3ec00fcb6e72 /clang/test/Sema/compound-literal.c
parent48f22f0b801211d05fbd90d9d3566345b708babc (diff)
downloadbcm5719-llvm-08ddb8c55cba887f7c09da896a0982d7a60efc37.tar.gz
bcm5719-llvm-08ddb8c55cba887f7c09da896a0982d7a60efc37.zip
Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
llvm-svn: 45782
Diffstat (limited to 'clang/test/Sema/compound-literal.c')
-rw-r--r--clang/test/Sema/compound-literal.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/test/Sema/compound-literal.c b/clang/test/Sema/compound-literal.c
index 2c9595c50e4..12ee9f9300a 100644
--- a/clang/test/Sema/compound-literal.c
+++ b/clang/test/Sema/compound-literal.c
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -verify -pedantic %s
struct foo { int a, b; };
@@ -8,9 +8,13 @@ static struct foo t3 = t2; // -expected-error {{initializer element is not const
static int *p = (int []){2,4};
static int x = (int){1}; // -expected-error {{initializer element is not constant}} -expected-warning{{braces around scalar initializer}}
+static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not constant}}
+static int *p3 = (int []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'char *', expected 'int'}}
+
extern void fooFunc(struct foo *pfoo);
int main(int argc, char **argv) {
+ int *l = (int []){x, *p, *p2};
fooFunc(&(struct foo){ 1, 2 });
}
OpenPOWER on IntegriCloud