brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 9df939c Raw
32 lines · c
1// RUN: %clang_cc1 -verify=expected,both -std=c2y -Wall -pedantic %s2// RUN: %clang_cc1 -verify=clang,both -Wall -pedantic %s3 4/* WG14 N3342: Yes5 * Slay Some Earthly Demons IV6 *7 * Qualified function types are now implementation-defined instead of8 * undefined. Clang strips the qualifiers.9 */10 11typedef int f(void);12 13const 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                   */16volatile 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 20const 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__ >= 201112L27// 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#endif30 31// There's no point to testing 'restrict' because that requires a pointer type.32