]> granicus.if.org Git - clang/commitdiff
Improve compound literal test case.
authorTed Kremenek <kremenek@apple.com>
Thu, 30 Oct 2008 18:46:50 +0000 (18:46 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 30 Oct 2008 18:46:50 +0000 (18:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58447 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/stack-addr-ps.c

index d0294aa9d30dfbeb76469e99f65b8be98fc72dc7..9bf89541107344cdf61f3ce2dd9e8c3fd39d7da3 100644 (file)
@@ -18,7 +18,11 @@ int* f3(int x, int *y) {
   return y; // expected-warning{{Address of stack memory associated with local variable 'w' returned.}}
 }
 
-unsigned short* compound_literal() {
-  return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}}
+void* compound_literal(int x) {
+  if (x)
+    return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}}
+  
+  struct s { int z; double y; int w; };
+  return &((struct s){ 2, 0.4, 5 * 8 });
 }