summaryrefslogtreecommitdiff
path: root/clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp
blob: 44cc5a7cfaa3a1f09f4b53b54fa4dc6e10adefda (about) (plain)
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
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++0x-compat %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}}
auto void af(); // expected-error {{illegal storage class on function}}

register int ro; // expected-error {{illegal storage class on file-scoped variable}}
register void rf(); // expected-error {{illegal storage class on function}}

struct S {
  auto int ao; // expected-error {{storage class specified for a member declaration}}
  auto void af(); // expected-error {{storage class specified for a member declaration}}

  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) {
  auto int abo;
  auto void abf(); // expected-error {{illegal storage class on function}}

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