aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/dcl.decl/dcl.meaning/p1-0x.cpp
blob: 8dcbaf8381d125c255452f11dc0e2d050c1c46b8 (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 -std=c++11 %s

// The nested-name-specifier of a qualified declarator-id shall not begin with a decltype-specifier.
class foo {
  static int i;
  void func();
};

int decltype(foo())::i; // expected-error{{'decltype' cannot be used to name a declaration}}
void decltype(foo())::func() { // expected-error{{'decltype' cannot be used to name a declaration}}
}


template<typename T>
class tfoo {
  static int i;
  void func();
};

template<typename T>
int decltype(tfoo<T>())::i; // expected-error{{'decltype' cannot be used to name a declaration}} \
                               expected-error{{nested name specifier 'decltype(tfoo<T>())::' for declaration does not refer into a class, class template or class template partial specialization}}
template<typename T>
void decltype(tfoo<T>())::func() { // expected-error{{'decltype' cannot be used to name a declaration}} \
                               expected-error{{nested name specifier 'decltype(tfoo<T>())::' for declaration does not refer into a class, class template or class template partial specialization}}
}