diff options
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/declspec.c | 8 | ||||
-rw-r--r-- | clang/test/Sema/exprs.c | 9 | ||||
-rw-r--r-- | clang/test/Sema/types.c | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/clang/test/Sema/declspec.c b/clang/test/Sema/declspec.c index 6e29625792d..0207b4aacc5 100644 --- a/clang/test/Sema/declspec.c +++ b/clang/test/Sema/declspec.c @@ -16,8 +16,8 @@ static void buggy(int *x) { } // expected-error {{function definition declared ' // Type qualifiers. typedef int f(void); typedef f* fptr; -const f* v1; // expected-warning {{qualifier on function type 'f' has unspecified behavior}} -__restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' is invalid)}} -__restrict__ fptr v3; // expected-error {{pointer to function type 'f' may not be 'restrict' qualified}} -f *__restrict__ v4; // expected-error {{pointer to function type 'f' may not be 'restrict' qualified}} +const f* v1; // expected-warning {{qualifier on function type 'f' (aka 'int (void)') has unspecified behavior}} +__restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' (aka 'int (void)') is invalid)}} +__restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}} +f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}} diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c index 4ddb976eb2e..ba411c528da 100644 --- a/clang/test/Sema/exprs.c +++ b/clang/test/Sema/exprs.c @@ -64,3 +64,12 @@ void test10(int n,...) { } s; double x = s.a[0]; // should not get another error here. } + + +#define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) + +struct mystruct {int A; }; +void foo(struct mystruct P, float F) { + MYMAX(P, F); // expected-error {{invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))}} +} + diff --git a/clang/test/Sema/types.c b/clang/test/Sema/types.c index 208abce3d96..da025884613 100644 --- a/clang/test/Sema/types.c +++ b/clang/test/Sema/types.c @@ -5,6 +5,6 @@ typedef int (*T)[2]; restrict T x; typedef int *S[2]; -restrict S y; // expected-error {{restrict requires a pointer or reference ('S' is invalid)}} +restrict S y; // expected-error {{restrict requires a pointer or reference ('S' (aka 'int *[2]') is invalid)}} |