| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 -Wc++11-compat %s |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
| 4 |
|
| 5 |
namespace N { |
| 6 |
template<class T> class Y { // expected-note{{explicit instantiation refers here}} |
| 7 |
void mf() { } |
| 8 |
}; |
| 9 |
} |
| 10 |
|
| 11 |
template class Z<int>; // expected-error{{explicit instantiation of undeclared template class 'Z'}} |
| 12 |
|
| 13 |
struct Q; |
| 14 |
template 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 reflector |
| 17 |
// on 10/27/2009 |
| 18 |
using N::Y; |
| 19 |
template class Y<int>; |
| 20 |
#if __cplusplus <= 199711L |
| 21 |
// expected-warning@-2 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}} |
| 22 |
#else |
| 23 |
// expected-error@-4 {{explicit instantiation of 'N::Y' must occur in namespace 'N'}} |
| 24 |
#endif |
| 25 |
|
| 26 |
template class N::Y<char*>; |
| 27 |
template void N::Y<double>::mf(); |