diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/Parser/expressions.c | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/Parser/expressions.c')
-rw-r--r-- | test/Parser/expressions.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c new file mode 100644 index 0000000..2b4d463 --- /dev/null +++ b/test/Parser/expressions.c @@ -0,0 +1,50 @@ +// RUN: clang-cc -parse-noop -verify %s + +void test1() { + if (sizeof (int){ 1}); // sizeof compound literal + if (sizeof (int)); // sizeof type + + (int)4; // cast. + (int){4}; // compound literal. + + // FIXME: change this to the struct version when we can. + //int A = (struct{ int a;}){ 1}.a; + int A = (int){ 1}.a; +} + +int test2(int a, int b) { + return a ? a,b : a; +} + +int test3(int a, int b, int c) { + return a = b = c; +} + +int test4() { + test4(); +} + +int test_offsetof() { + // FIXME: change into something that is semantically correct. + __builtin_offsetof(int, a.b.c[4][5]); +} + +void test_sizeof(){ + int arr[10]; + sizeof arr[0]; + sizeof(arr[0]); + sizeof(arr)[0]; +} + +// PR3418 +int test_leading_extension() { + __extension__ (*(char*)0) = 1; +} + +// PR3972 +int test5(int); +int test6(void) { + return test5( // expected-note {{to match}} + test5(1) + ; // expected-error {{expected ')'}} +} |