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
This commit is contained in:
parent
ab7b72e100
commit
802813eab9
3 changed files with 6 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue