xref: /aosp_15_r20/external/clang/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
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
4 
5 namespace N {
6   template<class T> class X; // expected-note {{'N::X' declared here}}
7 #if __cplusplus <= 199711L
8   // expected-note@-2 {{explicitly specialized declaration is here}}
9 #endif
10 }
11 
12 // TODO: Don't add a namespace qualifier to the template if it would trigger
13 // the warning about the specialization being outside of the namespace.
14 template<> class X<int> { /* ... */ };	// expected-error {{no template named 'X'; did you mean 'N::X'?}}
15 #if __cplusplus <= 199711L
16 // expected-warning@-2 {{first declaration of class template specialization of 'X' outside namespace 'N' is a C++11 extension}}
17 #endif
18 
19 namespace N {
20 
21 template<> class X<char*> { /* ... */ };	// OK: X is a template
22 
23 }
24