Reid Kleckner | b2da086 | 2018-03-07 18:55:10 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 %s -verify -fno-spell-checking |
| 2 | |
| 3 | // These test cases are constructed to make clang call ActOnStartOfFunctionDef |
| 4 | // with nullptr. |
| 5 | |
| 6 | struct ImplicitDefaultCtor1 {}; |
| 7 | struct Foo { |
| 8 | typedef int NameInClass; |
| 9 | void f(); |
| 10 | }; |
| 11 | namespace bar { |
| 12 | // FIXME: Improved our recovery to make this a redeclaration of Foo::f, |
| 13 | // even though this is in the wrong namespace. That will allow name lookup to |
| 14 | // find NameInClass below. Users are likely to hit this when they forget to |
| 15 | // close namespaces. |
| 16 | // expected-error@+1 {{cannot define or redeclare 'f' here}} |
| 17 | void Foo::f() { |
| 18 | switch (0) { case 0: ImplicitDefaultCtor1 o; } |
| 19 | // expected-error@+1 {{unknown type name 'NameInClass'}} |
| 20 | NameInClass var; |
| 21 | } |
| 22 | } // namespace bar |
| 23 | |
| 24 | struct ImplicitDefaultCtor2 {}; |
| 25 | template <typename T> class TFoo { void f(); }; |
| 26 | // expected-error@+1 {{nested name specifier 'decltype(TFoo<T>())::'}} |
| 27 | template <typename T> void decltype(TFoo<T>())::f() { |
| 28 | switch (0) { case 0: ImplicitDefaultCtor1 o; } |
| 29 | } |
| 30 | |
| 31 | namespace tpl2 { |
| 32 | struct ImplicitDefaultCtor3 {}; |
| 33 | template <class T1> class A { |
| 34 | template <class T2> class B { |
| 35 | void mf2(); |
| 36 | }; |
| 37 | }; |
| 38 | template <class Y> |
| 39 | template <> |
| 40 | // expected-error@+1 {{nested name specifier 'A<Y>::B<double>::'}} |
| 41 | void A<Y>::B<double>::mf2() { |
| 42 | switch (0) { case 0: ImplicitDefaultCtor3 o; } |
| 43 | } |
| 44 | } |