brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 723a796 Raw
67 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5// The auto or register specifiers can be applied only to names of objects6// declared in a block (6.3) or to function parameters (8.4).7 8auto int ao; // expected-error {{illegal storage class on file-scoped variable}}9#if __cplusplus >= 201103L // C++11 or later10// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}11#endif12 13auto void af(); // expected-error {{illegal storage class on function}}14#if __cplusplus >= 201103L // C++11 or later15// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}16#endif17 18register int ro; // expected-error {{illegal storage class on file-scoped variable}}19#if __cplusplus >= 201703L20// expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}}21#elif __cplusplus >= 201103L22// expected-warning@-4 {{'register' storage class specifier is deprecated}}23#endif24 25register void rf(); // expected-error {{illegal storage class on function}}26 27struct S {28  auto int ao; // expected-error {{storage class specified for a member declaration}}29#if __cplusplus >= 201103L // C++11 or later30// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}31#endif32  auto void af(); // expected-error {{storage class specified for a member declaration}}33#if __cplusplus >= 201103L // C++11 or later34// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}35#endif36 37  register int ro; // expected-error {{storage class specified for a member declaration}}38  register void rf(); // expected-error {{storage class specified for a member declaration}}39};40 41void foo(auto int ap, register int rp) {42#if __cplusplus >= 201703L43// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}44// expected-error@-3 {{ISO C++17 does not allow 'register' storage class specifier}}45#elif __cplusplus >= 201103L46// expected-warning@-5 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}47// expected-warning@-6 {{'register' storage class specifier is deprecated}}48#endif49  auto int abo;50#if __cplusplus >= 201103L // C++11 or later51// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}52#endif53  auto void abf(); // expected-error {{illegal storage class on function}}54#if __cplusplus >= 201103L // C++11 or later55// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}56#endif57 58  register int rbo;59#if __cplusplus >= 201703L60// expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}}61#elif __cplusplus >= 201103L62// expected-warning@-4 {{'register' storage class specifier is deprecated}}63#endif64 65  register void rbf(); // expected-error {{illegal storage class on function}}66}67