blob: 78f6db40d5c85fc23d5e902e1fe605c4f4451f20 [file] [log] [blame]
Nick Lewyckyfe712382010-08-20 20:54:15 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
Nico Weber3c10fb12012-06-22 16:39:39 +00003// Clang used to crash trying to recover while adding 'this->' before Work(x);
Nick Lewyckyfe712382010-08-20 20:54:15 +00004
5template <typename> struct A {
6 static void Work(int); // expected-note{{must qualify identifier}}
7};
8
9template <typename T> struct B : public A<T> {
10 template <typename T2> B(T2 x) {
11 Work(x); // expected-error{{use of undeclared identifier}}
12 }
13};
14
15void Test() {
16 B<int> b(0); // expected-note{{in instantiation of function template}}
17}
18
Richard Smithccf01512013-07-22 18:09:32 +000019
20// Don't crash here.
21namespace PR16134 {
22 template <class P> struct S // expected-error {{expected ';'}}
23 template <> static S<Q>::f() // expected-error +{{}}
24}
Serge Pavlov074a5182013-08-10 12:00:21 +000025
26namespace PR16225 {
27 template <typename T> void f();
28 template<typename C> void g(C*) {
29 struct LocalStruct : UnknownBase<Mumble, C> { }; // expected-error {{unknown template name 'UnknownBase'}} \
30 // expected-error {{use of undeclared identifier 'Mumble'}}
31 f<LocalStruct>(); // expected-warning {{template argument uses local type 'LocalStruct'}}
32 }
33 struct S;
34 void h() {
35 g<S>(0); // expected-note {{in instantiation of function template specialization}}
36 }
37}