p1-0x.cpp revision df512bfbc4b8c00202ea7a8c900c59ec55890676
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2 3// The nested-name-specifier of a qualified declarator-id shall not begin with a decltype-specifier. 4class foo { 5 static int i; 6 void func(); 7}; 8 9int decltype(foo())::i; // expected-error{{'decltype' cannot be used to name a declaration}} 10void decltype(foo())::func() { // expected-error{{'decltype' cannot be used to name a declaration}} 11} 12 13 14template<typename T> 15class tfoo { 16 static int i; 17 void func(); 18}; 19 20template<typename T> 21int decltype(tfoo<T>())::i; // expected-error{{'decltype' cannot be used to name a declaration}} \ 22 expected-error{{nested name specifier 'decltype(tfoo<T>())::' for declaration does not refer into a class, class template or class template partial specialization}} 23template<typename T> 24void decltype(tfoo<T>())::func() { // expected-error{{'decltype' cannot be used to name a declaration}} \ 25 expected-error{{nested name specifier 'decltype(tfoo<T>())::' for declaration does not refer into a class, class template or class template partial specialization}} 26} 27