summaryrefslogtreecommitdiff
path: root/test/SemaTemplate
diff options
context:
space:
mode:
authorLarisse Voufo <lvoufo@google.com>2013-07-19 22:53:23 +0000
committerLarisse Voufo <lvoufo@google.com>2013-07-19 22:53:23 +0000
commit8c5d4078bb40642847164e7613828262d32db973 (patch)
treecf1378b73643e3321ffd175f5743d021531a6e8c /test/SemaTemplate
parentba037f2a0cd9bc5614813c3c9293e4e01436e4dd (diff)
downloadclang-8c5d4078bb40642847164e7613828262d32db973.tar.gz
Revert "Use function overloading instead of template specialization for diagnosis of bad template argument deductions."
This reverts commit a730f548325756d050d4caaa28fcbffdae8dfe95. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r--test/SemaTemplate/explicit-instantiation.cpp15
-rw-r--r--test/SemaTemplate/function-template-specialization.cpp3
2 files changed, 8 insertions, 10 deletions
diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp
index 04a863bdc1..e3e77d0828 100644
--- a/test/SemaTemplate/explicit-instantiation.cpp
+++ b/test/SemaTemplate/explicit-instantiation.cpp
@@ -15,9 +15,9 @@ struct X0 {
return x + 1; // expected-error{{invalid operands}}
}
T* f0(T*, T*) { return T(); } // expected-warning{{expression which evaluates to zero treated as a null pointer constant of type 'int *'}}
-
- template <typename U> T f0(T, U) { return T(); } // expected-note {{candidate template ignored: could not match 'int (int, U)' against 'int (int) const'}} \
- // expected-note {{candidate template ignored: could not match 'int' against 'int *'}}
+
+ template<typename U>
+ T f0(T, U) { return T(); }
};
template<typename T>
@@ -59,14 +59,13 @@ template int *X2::f1(int *); // okay
template void X2::f2(int *, int *); // expected-error{{ambiguous}}
-template <typename T>
-void print_type() {} // expected-note {{candidate template ignored: could not match 'void ()' against 'void (float *)'}}
+
+template<typename T> void print_type() { }
template void print_type<int>();
template void print_type<float>();
-template <typename T>
-void print_type(T *) {} // expected-note {{candidate template ignored: could not match 'void (int *)' against 'void (float *)'}}
+template<typename T> void print_type(T*) { }
template void print_type(int*);
template void print_type<int>(float*); // expected-error{{does not refer}}
@@ -95,7 +94,7 @@ namespace PR7622 {
template<typename,typename>
struct basic_streambuf{friend bob<>()}; // expected-error{{unknown type name 'bob'}} \
- // expected-error{{expected member name or ';' after declaration specifiers}}
+ // expected-error{{expected member name or ';' after declaration specifiers}}
template struct basic_streambuf<int>;
}
diff --git a/test/SemaTemplate/function-template-specialization.cpp b/test/SemaTemplate/function-template-specialization.cpp
index 6327ff64c3..2338b6701c 100644
--- a/test/SemaTemplate/function-template-specialization.cpp
+++ b/test/SemaTemplate/function-template-specialization.cpp
@@ -1,7 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template <int N>
-void f0(int (&array)[N]); // expected-note {{candidate template ignored: could not match 'int' against 'char'}}
+template<int N> void f0(int (&array)[N]);
// Simple function template specialization (using overloading)
template<> void f0(int (&array)[1]);