1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 // Clang used to crash trying to recover while adding 'this->' before Work(x);
7 template <typename
> struct A
{
8 static void Work(int); // expected-note{{here}}
11 template <typename T
> struct B
: public A
<T
> {
12 template <typename T2
> B(T2 x
) {
13 Work(x
); // expected-error{{explicit qualification required}}
18 B
<int> b(0); // expected-note{{in instantiation of function template}}
24 template <class P
> struct S
// expected-error {{expected ';'}}
25 template <> static S
<Q
>::f() // expected-error +{{}}
29 template <typename T
> void f();
30 template <typename C
> void g(C
*) {
31 struct LocalStruct
: UnknownBase
<Mumble
, C
> { }; // expected-error {{use of undeclared identifier 'Mumble'}}
33 #if __cplusplus <= 199711L
34 // expected-warning@-2 {{template argument uses local type 'LocalStruct'}}
36 struct LocalStruct2
: UnknownBase
<C
> { }; // expected-error {{no template named 'UnknownBase'}}
41 #if __cplusplus <= 199711L
42 // expected-note@-2 {{in instantiation of function template specialization}}
48 template <typename
> class ArraySlice
{};
50 class NonTemplateClass
{
51 void MemberFunction(ArraySlice
<Foo
>, int);
52 template <class T
> void MemberFuncTemplate(ArraySlice
<T
>, int);
54 void NonTemplateClass::MemberFunction(ArraySlice
<Foo
> resource_data
,
56 // expected-note@+1 {{in instantiation of function template specialization 'test1::NonTemplateClass::MemberFuncTemplate<test1::Foo>'}}
57 MemberFuncTemplate(resource_data
, now
);
60 void NonTemplateClass::MemberFuncTemplate(ArraySlice
<T
> resource_data
, int) {
61 // expected-error@+1 {{member 'UndeclaredMethod' used before its declaration}}
62 UndeclaredMethod(resource_data
);
64 // expected-error@+2 {{out-of-line definition of 'UndeclaredMethod' does not match any declaration}}
65 // expected-note@+1 {{member is declared here}}
66 void NonTemplateClass::UndeclaredMethod() {}