From: Douglas Gregor Date: Tue, 27 Oct 2009 15:00:12 +0000 (+0000) Subject: Test various aspects of explicit instantiation that were already implemented. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e46c7f524297452e1c9800792e403beca6c92a1a;p=clang Test various aspects of explicit instantiation that were already implemented. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85243 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CXX/temp/temp.spec/temp.explicit/p12.cpp b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp new file mode 100644 index 0000000000..fdf4393d43 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp @@ -0,0 +1,6 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +char* p = 0; +template T g(T x = &p) { return x; } +template int g(int); // OK even though &p isn’t an int. + diff --git a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp new file mode 100644 index 0000000000..ee75602770 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp @@ -0,0 +1,18 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +namespace N { + template class Y { // expected-note{{explicit instantiation refers here}} + void mf() { } + }; +} + +// FIXME: poor diagnostic +template class Z; // expected-error{{unqualified-id}} + +// FIXME: This example from the standard is wrong; note posted to CWG reflector +// on 10/27/2009 +using N::Y; +template class Y; // expected-error{{must occur in}} + +template class N::Y; +template void N::Y::mf(); diff --git a/test/CXX/temp/temp.spec/temp.explicit/p6.cpp b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp new file mode 100644 index 0000000000..763d679db7 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template class Array { /* ... */ }; +template void sort(Array& v) { } + +// instantiate sort(Array&) - template-argument deduced +template void sort<>(Array&); + +template void sort(Array&); + +template void f0(T, U*) { } + +template void f0(int, float*); +template void f0<>(double, float*);