diff options
author | Jason Merrill <jason@redhat.com> | 2019-02-18 16:35:48 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-02-18 16:35:48 -0500 |
commit | 802813eab9ab6f05a7a81161f372ac5be0b120a4 (patch) | |
tree | 4f00a5a579cba57de7870560d4c60a2bb6a99b84 /gcc | |
parent | ab7b72e10002e96c0a092a6a2ef6ba2a9ec25f2b (diff) | |
download | gcc-802813eab9ab6f05a7a81161f372ac5be0b120a4.zip gcc-802813eab9ab6f05a7a81161f372ac5be0b120a4.tar.gz gcc-802813eab9ab6f05a7a81161f372ac5be0b120a4.tar.bz2 |
Improve diagnostic for redundant template arguments in declaration.
* pt.c (check_explicit_specialization): If the declarator is a
template-id, only check whether the arguments are dependent.
From-SVN: r268997
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.robertl/eb82.C | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d820e94..33a1ca2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2019-02-18 Jason Merrill <jason@redhat.com> + * pt.c (check_explicit_specialization): If the declarator is a + template-id, only check whether the arguments are dependent. + Improve duplicate [[likely]] diagnostic. * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it to process_stmt_hotness_attribute. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 48cbf3d..d8be92d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2849,7 +2849,7 @@ check_explicit_specialization (tree declarator, /* This case handles bogus declarations like template <> template <class T> void f<int>(); */ - if (!uses_template_parms (declarator)) + if (!uses_template_parms (TREE_OPERAND (declarator, 1))) error ("template-id %qD in declaration of primary template", declarator); else if (variable_template_p (TREE_OPERAND (declarator, 0))) diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C index fc2bf78..d4c5985 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb82.C @@ -2,7 +2,8 @@ #include <stdio.h> template <int n1> -double val <int> () // { dg-error "" } bogus code +double val <int> () // { dg-error "expected" "" { target c++17_down } } bogus code +// { dg-error "template-id .val<int>. in declaration of primary template" "" { target c++2a } .-1 } { return (double) n1; } |