28 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wc++11-compat %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5namespace N {6 template<class T> class Y { // expected-note{{explicit instantiation refers here}}7 void mf() { } 8 };9}10 11template class Z<int>; // expected-error{{explicit instantiation of undeclared template class 'Z'}}12 13struct Q;14template class Q<int>; // expected-error{{explicit instantiation of non-template class 'Q'}}15 16// FIXME: This example from the standard is wrong; note posted to CWG reflector17// on 10/27/200918using N::Y; 19template class Y<int>;20#if __cplusplus <= 199711L21// expected-warning@-2 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}}22#else23// expected-error@-4 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}}24#endif25 26template class N::Y<char*>; 27template void N::Y<double>::mf();28