diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-01 18:32:35 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-01 18:32:35 +0000 |
commit | b7a09260204f2079e0f998bf7ee52b95122a4c5d (patch) | |
tree | 4e8b09d886533551e6ddeea421282d59888cf5a0 /test/SemaTemplate/temp_arg_nontype.cpp | |
parent | 5d93ed3c7a2dae0a8f422747e269963b3ef11d95 (diff) | |
download | clang-b7a09260204f2079e0f998bf7ee52b95122a4c5d.tar.gz clang-b7a09260204f2079e0f998bf7ee52b95122a4c5d.tar.bz2 clang-b7a09260204f2079e0f998bf7ee52b95122a4c5d.tar.xz |
Overhaul checking of non-type template arguments that should refer to
an object or function. Our previous checking was too lax, and ended up
allowing missing or extraneous address-of operators, among other
evils. The new checking provides better diagnostics and adheres more
closely to the standard.
Fixes PR6563 and PR6749.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_arg_nontype.cpp')
-rw-r--r-- | test/SemaTemplate/temp_arg_nontype.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 51e12e994c..6e4f751d47 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -47,10 +47,8 @@ A3<h> *a14_1; A3<&h> *a14_2; A3<f> *a14_3; A3<&f> *a14_4; -A3<h2> *a14_6; // expected-error{{non-type template argument of type 'float (*)(float)' cannot be converted to a value of type 'int (*)(int)'}} -A3<g> *a14_7; // expected-error{{non-type template argument of type '<overloaded function type>' cannot be converted to a value of type 'int (*)(int)'}} -// FIXME: the first error includes the string <overloaded function -// type>, which makes Doug slightly unhappy. +A3<h2> *a14_6; // expected-error{{non-type template argument of type 'float (float)' cannot be converted to a value of type 'int (*)(int)'}} +A3<g> *a14_7; // expected-error{{overloaded function cannot be resolved to a non-type template parameter of type 'int (*)(int)'}} struct Y { } y; @@ -59,17 +57,15 @@ volatile X * X_volatile_ptr; template<X const &AnX> struct A4; // expected-note 2{{template parameter is declared here}} X an_X; A4<an_X> *a15_1; // okay -A4<*X_volatile_ptr> *a15_2; // expected-error{{reference binding of non-type template parameter of type 'X const &' to template argument of type 'X volatile' ignores qualifiers}} +A4<*X_volatile_ptr> *a15_2; // expected-error{{non-type template argument does not refer to any declaration}} A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'X const &' cannot bind to template argument of type 'struct Y'}} \ // FIXME: expected-error{{expected unqualified-id}} template<int (&fr)(int)> struct A5; // expected-note 2{{template parameter is declared here}} A5<h> *a16_1; A5<f> *a16_3; -A5<h2> *a16_6; // expected-error{{non-type template argument of type 'float (float)' cannot be converted to a value of type 'int (&)(int)'}} -A5<g> *a14_7; // expected-error{{non-type template argument of type '<overloaded function type>' cannot be converted to a value of type 'int (&)(int)'}} -// FIXME: the first error includes the string <overloaded function -// type>, which makes Doug slightly unhappy. +A5<h2> *a16_6; // expected-error{{non-type template parameter of reference type 'int (&)(int)' cannot bind to template argument of type 'float (float)'}} +A5<g> *a14_7; // expected-error{{overloaded function cannot be resolved to a non-type template parameter of type 'int (&)(int)'}} struct Z { int foo(int); |