Home | History | Annotate | Download | only in dcl.stc
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
      3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
      4 
      5 // The auto or register specifiers can be applied only to names of objects
      6 // declared in a block (6.3) or to function parameters (8.4).
      7 
      8 auto int ao; // expected-error {{illegal storage class on file-scoped variable}}
      9 #if __cplusplus >= 201103L // C++11 or later
     10 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     11 #endif
     12 
     13 auto void af(); // expected-error {{illegal storage class on function}}
     14 #if __cplusplus >= 201103L // C++11 or later
     15 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     16 #endif
     17 
     18 register int ro; // expected-error {{illegal storage class on file-scoped variable}}
     19 #if __cplusplus >= 201103L // C++11 or later
     20 // expected-warning@-2 {{'register' storage class specifier is deprecated}}
     21 #endif
     22 
     23 register void rf(); // expected-error {{illegal storage class on function}}
     24 
     25 struct S {
     26   auto int ao; // expected-error {{storage class specified for a member declaration}}
     27 #if __cplusplus >= 201103L // C++11 or later
     28 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     29 #endif
     30   auto void af(); // expected-error {{storage class specified for a member declaration}}
     31 #if __cplusplus >= 201103L // C++11 or later
     32 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     33 #endif
     34 
     35   register int ro; // expected-error {{storage class specified for a member declaration}}
     36   register void rf(); // expected-error {{storage class specified for a member declaration}}
     37 };
     38 
     39 void foo(auto int ap, register int rp) {
     40 #if __cplusplus >= 201103L // C++11 or later
     41 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     42 #endif
     43   auto int abo;
     44 #if __cplusplus >= 201103L // C++11 or later
     45 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     46 #endif
     47   auto void abf(); // expected-error {{illegal storage class on function}}
     48 #if __cplusplus >= 201103L // C++11 or later
     49 // expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
     50 #endif
     51 
     52   register int rbo;
     53 #if __cplusplus >= 201103L // C++11 or later
     54 // expected-warning@-2 {{'register' storage class specifier is deprecated}}
     55 #endif
     56 
     57   register void rbf(); // expected-error {{illegal storage class on function}}
     58 }
     59