1ab6bc1d1SDouglas Gregor // RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s
264a1a81eSCharles Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wc++11-compat %s
364a1a81eSCharles Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4969c2a23SDouglas Gregor 
5969c2a23SDouglas Gregor namespace N {
6969c2a23SDouglas Gregor   template<class T> class Y { // expected-note{{explicit instantiation refers here}}
mf()7969c2a23SDouglas Gregor     void mf() { }
8969c2a23SDouglas Gregor   };
9969c2a23SDouglas Gregor }
10969c2a23SDouglas Gregor 
11*b23c5e8cSRichard Smith template class Z<int>; // expected-error{{explicit instantiation of undeclared template class 'Z'}}
12*b23c5e8cSRichard Smith 
13*b23c5e8cSRichard Smith struct Q;
14*b23c5e8cSRichard Smith template class Q<int>; // expected-error{{explicit instantiation of non-template class 'Q'}}
15969c2a23SDouglas Gregor 
16969c2a23SDouglas Gregor // FIXME: This example from the standard is wrong; note posted to CWG reflector
17969c2a23SDouglas Gregor // on 10/27/2009
18969c2a23SDouglas Gregor using N::Y;
1964a1a81eSCharles Li template class Y<int>;
2064a1a81eSCharles Li #if __cplusplus <= 199711L
2164a1a81eSCharles Li // expected-warning@-2 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}}
2264a1a81eSCharles Li #else
2364a1a81eSCharles Li // expected-error@-4 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}}
2464a1a81eSCharles Li #endif
25969c2a23SDouglas Gregor 
26969c2a23SDouglas Gregor template class N::Y<char*>;
27969c2a23SDouglas Gregor template void N::Y<double>::mf();
28