diff options
author | Jason Merrill <jason@redhat.com> | 2018-11-12 23:47:20 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-11-12 23:47:20 -0500 |
commit | 7d119905abdf28f56486be0ca01a42f8efcea1a2 (patch) | |
tree | ea8bf50fae9497d15cbee4407a37515b686e65af /gcc/testsuite | |
parent | 7c23c87c93f3eafa5c22d1f4f52711d97f3a4329 (diff) | |
download | gcc-7d119905abdf28f56486be0ca01a42f8efcea1a2.zip gcc-7d119905abdf28f56486be0ca01a42f8efcea1a2.tar.gz gcc-7d119905abdf28f56486be0ca01a42f8efcea1a2.tar.bz2 |
Avoid double substitution with complete explicit template arguments.
Previously, when we got a function template with explicit arguments for all
of the template parameters, we still did "deduction", which of course
couldn't deduce anything, but did other deduction-time checking of
non-dependent conversions and such. This broke down with the unevaluated
lambdas patch (to follow): substituting into the lambda multiple times, once
to get the function type for deduction and then again to generate the actual
decl, doesn't work, since different substitutions of a lambda produce
different types. I believe that skipping the initial substitution when we
have all the arguments is still conformant, and produces better diagnostics
for some testcases.
* pt.c (fn_type_unification): If we have a full set of explicit
arguments, go straight to substitution.
From-SVN: r266055
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype48.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/diag1.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/error4.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr77655.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/diagnostic/param-type-mismatch.C | 10 |
6 files changed, 14 insertions, 20 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype48.C b/gcc/testsuite/g++.dg/cpp0x/decltype48.C index 39fc4eb..7f5005b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/decltype48.C +++ b/gcc/testsuite/g++.dg/cpp0x/decltype48.C @@ -6,7 +6,7 @@ template<typename T> struct baz { }; template<typename T> T bar(); template<typename T, typename ... U> -baz<decltype(bar<Int>(bar<U>() ...))> // { dg-error "no match" } +baz<decltype(bar<Int>(bar<U>() ...))> // { dg-error "" } foo(); int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/diag1.C b/gcc/testsuite/g++.dg/cpp0x/diag1.C index 9bf7cfe..1f8c4a4 100644 --- a/gcc/testsuite/g++.dg/cpp0x/diag1.C +++ b/gcc/testsuite/g++.dg/cpp0x/diag1.C @@ -23,7 +23,7 @@ struct TypeC // TypeC::fn() // we don't want to see the template header, return type, or parameter bindings // for TypeB::fn. - template <int N> auto fn() -> decltype(b.fn<N>()); // { dg-bogus "typename|with" } + template <int N> auto fn() -> decltype(b.fn<N>()); // { dg-bogus "typename" } }; int main() diff --git a/gcc/testsuite/g++.dg/cpp0x/error4.C b/gcc/testsuite/g++.dg/cpp0x/error4.C index bd73b2a7..1f365b7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/error4.C +++ b/gcc/testsuite/g++.dg/cpp0x/error4.C @@ -12,7 +12,7 @@ struct S { template<typename U> static decltype(*declval<U>()) get(...); // { dg-error "operator*" } - typedef decltype(get<T>(declval<T>())) type; // { dg-error "no match" } + typedef decltype(get<T>(declval<T>())) type; // { dg-error "" } }; struct X { }; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77655.C b/gcc/testsuite/g++.dg/cpp0x/pr77655.C index ab2e942..8b4ffa6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr77655.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr77655.C @@ -3,7 +3,7 @@ template <class F> void g(F); template <class... A> -auto h(A &&... a) -> decltype(g(0, g<decltype(a)>(a)...)) { // { dg-error "no matching" } +auto h(A &&... a) -> decltype(g(0, g<decltype(a)>(a)...)) { // { dg-error "" } h([] {}); // { dg-error "no matching" } } diff --git a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C index f74f8d3..b19655d 100644 --- a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C +++ b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C @@ -134,21 +134,17 @@ int test_7 (int one, T two, float three); // { dg-line test_7_decl } int test_7 (int first, const char *second, float third) { return test_7 <const char **> (first, second, third); // { dg-line test_7_usage } - // { dg-error "no matching function" "" { target *-*-* } test_7_usage } + // { dg-message "cannot convert 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } test_7_usage } /* { dg-begin-multiline-output "" } return test_7 <const char **> (first, second, third); - ^ + ^~~~~~ + | + const char* { dg-end-multiline-output "" } */ - // { dg-message "candidate: 'template<class T> int test_7\\(int, T, float\\)'" "" { target *-*-* } test_7_decl } + // { dg-message "initializing argument 2 of 'int test_7\\(int, T, float\\) .with T = const char\\*\\*.'" "" { target *-*-* } test_7_decl } /* { dg-begin-multiline-output "" } int test_7 (int one, T two, float three); - ^~~~~~ - { dg-end-multiline-output "" } */ - // { dg-message "template argument deduction/substitution failed:" "" { target *-*-* } test_7_decl } - // { dg-message "cannot convert 'second' \\(type 'const char\\*'\\) to type 'const char\\*\\*'" "" { target *-*-* } test_7_usage } - /* { dg-begin-multiline-output "" } - return test_7 <const char **> (first, second, third); - ^~~~~~ + ~~^~~ { dg-end-multiline-output "" } */ } diff --git a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch.C b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch.C index 50bbd4a..cb5c360 100644 --- a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch.C +++ b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch.C @@ -130,18 +130,16 @@ int test_7 (int one, T two, float three); int test_7 (int first, int second, float third) { - return test_7 <const char *> (first, second, third); // { dg-error "no matching function" } - /* { dg-begin-multiline-output "" } - return test_7 <const char *> (first, second, third); - ^ - { dg-end-multiline-output "" } */ + return test_7 <const char *> (first, second, third); // { dg-error "invalid conversion from 'int' to 'const char\\*'" } /* { dg-begin-multiline-output "" } return test_7 <const char *> (first, second, third); ^~~~~~ + | + int { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } int test_7 (int one, T two, float three); - ^~~~~~ + ~~^~~ { dg-end-multiline-output "" } */ } |