| 1 |
// RUN: %clang_cc1 -verify=expected,both -std=c2y -Wall -pedantic %s |
| 2 |
// RUN: %clang_cc1 -verify=clang,both -Wall -pedantic %s |
| 3 |
|
| 4 |
/* WG14 N3342: Yes |
| 5 |
* Slay Some Earthly Demons IV |
| 6 |
* |
| 7 |
* Qualified function types are now implementation-defined instead of |
| 8 |
* undefined. Clang strips the qualifiers. |
| 9 |
*/ |
| 10 |
|
| 11 |
typedef int f(void); |
| 12 |
|
| 13 |
const f one; /* expected-warning {{'const' qualifier on function type 'f' (aka 'int (void)') has no effect}} |
| 14 |
clang-warning {{'const' qualifier on function type 'f' (aka 'int (void)') has no effect and is a Clang extension}} |
| 15 |
*/ |
| 16 |
volatile f two; /* expected-warning {{'volatile' qualifier on function type 'f' (aka 'int (void)') has no effect}} |
| 17 |
clang-warning {{'volatile' qualifier on function type 'f' (aka 'int (void)') has no effect and is a Clang extension}} |
| 18 |
*/ |
| 19 |
|
| 20 |
const volatile f three; /* expected-warning {{'const' qualifier on function type 'f' (aka 'int (void)') has no effect}} |
| 21 |
clang-warning {{'const' qualifier on function type 'f' (aka 'int (void)') has no effect and is a Clang extension}} |
| 22 |
expected-warning {{'volatile' qualifier on function type 'f' (aka 'int (void)') has no effect}} |
| 23 |
clang-warning {{'volatile' qualifier on function type 'f' (aka 'int (void)') has no effect and is a Clang extension}} |
| 24 |
*/ |
| 25 |
|
| 26 |
#if __STDC_VERSION__ >= 201112L |
| 27 |
// Atomic types have an explicit constraint making it ill-formed. |
| 28 |
_Atomic f four; // both-error {{_Atomic cannot be applied to function type 'f' (aka 'int (void)')}} |
| 29 |
#endif |
| 30 |
|
| 31 |
// There's no point to testing 'restrict' because that requires a pointer type. |