diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-10-14 23:41:34 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-10-14 23:41:34 +0000 |
| commit | e47f5a76ccd74c13d5c319e12720275ef58a84fc (patch) | |
| tree | 604fe426fd2171a88f77f98b6758bfe5acc4a3c4 /clang/test/CXX/temp/temp.spec/temp.explicit/p2.cpp | |
| parent | 2f61e0946a9e3fe24d102e13d02a07f44b2728ba (diff) | |
| download | bcm5719-llvm-e47f5a76ccd74c13d5c319e12720275ef58a84fc.tar.gz bcm5719-llvm-e47f5a76ccd74c13d5c319e12720275ef58a84fc.zip | |
Additional semantic checking for explicit template instantiations,
focusing on the scope- and qualifier-related semantic requirements in
C++ [temp.explicit]p2.
llvm-svn: 84154
Diffstat (limited to 'clang/test/CXX/temp/temp.spec/temp.explicit/p2.cpp')
| -rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.explicit/p2.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.spec/temp.explicit/p2.cpp b/clang/test/CXX/temp/temp.spec/temp.explicit/p2.cpp new file mode 100644 index 00000000000..aee0e5d19d5 --- /dev/null +++ b/clang/test/CXX/temp/temp.spec/temp.explicit/p2.cpp @@ -0,0 +1,43 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// Example from the standard +template<class T> class Array { void mf() { } }; + +template class Array<char>; +template void Array<int>::mf(); +template<class T> void sort(Array<T>& v) { /* ... */ } +template void sort(Array<char>&); +namespace N { + template<class T> void f(T&) { } +} +template void N::f<int>(int&); + + +template<typename T> +struct X0 { + struct Inner {}; + void f() { } + static T value; +}; + +template<typename T> +T X0<T>::value = 17; + +typedef X0<int> XInt; + +template struct XInt::Inner; // expected-error{{template-id}} +template void XInt::f(); // expected-error{{template-id}} +template int XInt::value; // expected-error{{template-id}} + +namespace N { + template<typename T> + struct X1 { // expected-note{{explicit instantiation refers here}} + }; + + template<typename T> + void f1(T); // expected-note{{explicit instantiation refers here}} +} +using namespace N; + +template struct X1<int>; // expected-error{{must occur in}} +template void f1(int); // expected-error{{must occur in}} |

