1 // RUN: %clang_cc1 -verify=c2x -std=c2x %s
2 // RUN: %clang_cc1 -verify=c11 -std=c11 %s
3 // RUN: %clang_cc1 -verify=gnu11 -std=gnu11 %s
4 // RUN: %clang_cc1 -verify=pedantic -pedantic -std=gnu11 -Wno-comment %s
5 // RUN: %clang_cc1 -verify=compat -std=c2x -Wpre-c2x-compat %s
9 // Exercise the various circumstances under which we will diagnose use of
10 // typeof and typeof_unqual as either an extension or as a compatability
11 // warning. Note that GCC exposes 'typeof' as a non-conforming extension in
12 // standards before C2x, and Clang has followed suit. Neither compiler exposes
13 // 'typeof_unqual' as a non-conforming extension.
15 // Show what happens with the underscored version of the keyword, which is a
16 // conforming extension.
17 __typeof__(int) i
= 12;
19 // Show what happens with a regular 'typeof' use.
20 typeof(i
) j
= 12; // c11-error {{expected function body after function declarator}} \
21 pedantic
-warning
{{extension used
}} \
22 compat
-warning
{{'typeof' is incompatible with C standards before C2x
}}
24 // Same for 'typeof_unqual'.
25 typeof_unqual(j
) k
= 12; // c11-error {{expected function body after function declarator}} \
26 gnu11
-error
{{expected function body after function declarator
}} \
27 pedantic
-error
{{expected function body after function declarator
}} \
28 compat
-warning
{{'typeof_unqual' is incompatible with C standards before C2x
}}