summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/function-template-specialization.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-25 23:53:26 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-25 23:53:26 +0000
commit0e876e018081e8ba15d6f5c622d4ff669de43c03 (patch)
treedb2c5ec600173e818547fe2f48f40d8e31b5d082 /clang/test/SemaTemplate/function-template-specialization.cpp
parent394468dc8e8bf6407edfbbbbe4ba0287b47256d6 (diff)
downloadbcm5719-llvm-0e876e018081e8ba15d6f5c622d4ff669de43c03.tar.gz
bcm5719-llvm-0e876e018081e8ba15d6f5c622d4ff669de43c03.zip
Use explicitly-specified template argument lists to help naming
explicit template specializations, when available. llvm-svn: 82824
Diffstat (limited to 'clang/test/SemaTemplate/function-template-specialization.cpp')
-rw-r--r--clang/test/SemaTemplate/function-template-specialization.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/function-template-specialization.cpp b/clang/test/SemaTemplate/function-template-specialization.cpp
index 5946d9b680b..90e38cc882f 100644
--- a/clang/test/SemaTemplate/function-template-specialization.cpp
+++ b/clang/test/SemaTemplate/function-template-specialization.cpp
@@ -12,6 +12,7 @@ void test_f0() {
// Function template specialization where there are no matches
template<> void f0(char (&array)[1]); // expected-error{{no function template matches}}
+template<> void f0<2>(int (&array)[2]) { }
// Function template specialization that requires partial ordering
template<typename T, int N> void f1(T (&array)[N]); // expected-note{{matches}}
@@ -23,3 +24,12 @@ template<> void f1(int (&array)[1]);
// Function template specialization that results in an ambiguity
template<typename T> void f1(T (&array)[17]); // expected-note{{matches}}
template<> void f1(int (&array)[17]); // expected-error{{ambiguous}}
+
+// Resolving that ambiguity with explicitly-specified template arguments.
+template<int N> void f2(double (&array)[N]);
+template<typename T> void f2(T (&array)[42]);
+
+template<> void f2<double>(double (&array)[42]);
+template<> void f2<42>(double (&array)[42]);
+
+void f2<25>(double (&array)[25]); // expected-error{{specialization}}
OpenPOWER on IntegriCloud