1 // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++11 2 3 // base-clause: 4 // : base-specifier-list 5 // base-specifier-list: 6 // base-specifier ...[opt] 7 // base-specifier-list , base-specifier ...[opt] 8 // base-specifier: 9 // attribute-specifier-seq[opt] base-type-specifier 10 // attribute-specifier-seq[opt] virtual access-specifier[opt] base-type-specifier 11 // attribute-specifier-seq[opt] access-specifier virtual[opt] base-type-specifier 12 // class-or-decltype: 13 // nested-name-specifier[opt] class-name 14 // decltype-specifier 15 // base-type-specifier: 16 // class-or-decltype 17 // access-specifier: 18 // private 19 // protected 20 // public 21 22 namespace PR11216 { 23 struct Base { }; 24 struct Derived : decltype(Base()) { }; 25 26 int func(); 27 struct Derived2 : decltype(func()) { }; // expected-error {{base specifier must name a class}} 28 29 template<typename T> 30 struct Derived3 : decltype(T().foo()) { }; 31 struct Foo { Base foo(); }; 32 Derived3<Foo> d; 33 34 struct Derived4 : :: decltype(Base()) { }; // expected-error {{unexpected namespace scope prior to decltype}} 35 36 struct Derived5 : PR11216:: decltype(Base()) { }; // expected-error {{unexpected namespace scope prior to decltype}} 37 38 template<typename T> 39 struct Derived6 : typename T::foo { }; // expected-error {{'typename' is redundant; base classes are implicitly types}} 40 } 41