aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp
blob: 13721518e6f9ed07ab19a4c442e2a407585aac86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s

// The auto or register specifiers can be applied only to names of objects
// declared in a block (6.3) or to function parameters (8.4).

auto int ao; // expected-error {{illegal storage class on file-scoped variable}}
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
#endif

auto void af(); // expected-error {{illegal storage class on function}}
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
#endif

register int ro; // expected-error {{illegal storage class on file-scoped variable}}
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'register' storage class specifier is deprecated}}
#endif

register void rf(); // expected-error {{illegal storage class on function}}

struct S {
  auto int ao; // expected-error {{storage class specified for a member declaration}}
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
#endif
  auto void af(); // expected-error {{storage class specified for a member declaration}}
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
#endif

  register int ro; // expected-error {{storage class specified for a member declaration}}
  register void rf(); // expected-error {{storage class specified for a member declaration}}
};

void foo(auto int ap, register int rp) {
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
// expected-warning@-3 {{'register' storage class specifier is deprecated}}
#endif
  auto int abo;
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
#endif
  auto void abf(); // expected-error {{illegal storage class on function}}
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}}
#endif

  register int rbo;
#if __cplusplus >= 201103L // C++11 or later
// expected-warning@-2 {{'register' storage class specifier is deprecated}}
#endif

  register void rbf(); // expected-error {{illegal storage class on function}}
}