diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-02-27 04:46:32 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-02-27 04:46:32 +0000 |
commit | 8d03f59479561748165227dbc569ec2e02c38e30 (patch) | |
tree | a5af072647139a04423cd87a3138e7236c11927d | |
parent | 4e7a241f4919fda2f58a50b9b304dcd9c6570a52 (diff) | |
download | bcm5719-llvm-8d03f59479561748165227dbc569ec2e02c38e30.tar.gz bcm5719-llvm-8d03f59479561748165227dbc569ec2e02c38e30.zip |
Some additional ICE tests.
llvm-svn: 65614
-rw-r--r-- | clang/test/Sema/i-c-e.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Sema/i-c-e.c b/clang/test/Sema/i-c-e.c index 8fa840d4654..d8770755a12 100644 --- a/clang/test/Sema/i-c-e.c +++ b/clang/test/Sema/i-c-e.c @@ -1,5 +1,8 @@ // RUN: clang %s -fsyntax-only -verify -pedantic -fpascal-strings +#include <stdint.h> +#include <limits.h> + int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // rdar://6091492 - ?: with __builtin_constant_p as the operand is an i-c-e. @@ -46,3 +49,18 @@ int expr; char y[__builtin_constant_p(expr) ? -1 : 1]; char z[__builtin_constant_p(4) ? 1 : -1]; +// Comma tests +int comma1[0?1,2:3]; +int comma2[1||(1,2)]; +int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}} + +// Pointer + __builtin_constant_p +char pbcp[__builtin_constant_p(4) ? (intptr_t)&expr : 0]; // expected-error {{variable length array declaration not allowed at file scope}} + +int illegaldiv1[1 || 1/0]; +int illegaldiv2[1/0]; // expected-error {{variable length array declaration not allowed at file scope}} +int illegaldiv3[INT_MIN / -1]; // expected-error {{variable length array declaration not allowed at file scope}} + +int chooseexpr[__builtin_choose_expr(1, 1, expr)]; // expected-warning {{extension used}} +int realop[(__real__ 4) == 4 ? 1 : -1]; // expected-warning {{extension used}} +int imagop[(__imag__ 4) == 0 ? 1 : -1]; // expected-warning {{extension used}} |