2009-04-13 08:10:38 +08:00
|
|
|
// RUN: clang-cc -parse-noop -verify %s
|
2006-08-13 01:19:28 +08:00
|
|
|
|
|
|
|
void test1() {
|
|
|
|
if (sizeof (int){ 1}); // sizeof compound literal
|
|
|
|
if (sizeof (int)); // sizeof type
|
|
|
|
|
|
|
|
(int)4; // cast.
|
2007-08-25 13:31:19 +08:00
|
|
|
(int){4}; // compound literal.
|
2006-08-13 01:19:28 +08:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2006-08-13 02:11:24 +08:00
|
|
|
int test3(int a, int b, int c) {
|
2006-08-13 01:19:28 +08:00
|
|
|
return a = b = c;
|
|
|
|
}
|
2006-08-13 02:11:24 +08:00
|
|
|
|
|
|
|
int test4() {
|
|
|
|
test4();
|
|
|
|
}
|
2006-08-13 03:15:40 +08:00
|
|
|
|
|
|
|
int test_offsetof() {
|
|
|
|
// FIXME: change into something that is semantically correct.
|
|
|
|
__builtin_offsetof(int, a.b.c[4][5]);
|
|
|
|
}
|
2007-11-14 04:50:37 +08:00
|
|
|
|
|
|
|
void test_sizeof(){
|
|
|
|
int arr[10];
|
|
|
|
sizeof arr[0];
|
|
|
|
sizeof(arr[0]);
|
|
|
|
sizeof(arr)[0];
|
|
|
|
}
|
|
|
|
|
2009-01-27 16:43:38 +08:00
|
|
|
// PR3418
|
|
|
|
int test_leading_extension() {
|
|
|
|
__extension__ (*(char*)0) = 1;
|
|
|
|
}
|
2007-11-14 04:50:37 +08:00
|
|
|
|
2009-04-13 08:10:38 +08:00
|
|
|
// PR3972
|
|
|
|
int test5(int);
|
|
|
|
int test6(void) {
|
|
|
|
return test5( // expected-note {{to match}}
|
|
|
|
test5(1)
|
|
|
|
; // expected-error {{expected ')'}}
|
|
|
|
}
|