re PR c++/7841 (gcc accepts illegal member function syntax for template classes)
PR c++/7841 * parser.c (cp_parser_direct_declarator): Reject constructor named as qualified template-id. PR c++/7841 * g++.old-deja/g++.pt/ctor2.C: Add error mark. From-SVN: r82741
This commit is contained in:
parent
aa07e14d5d
commit
9221325f10
4 changed files with 22 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-06-08 Giovanni Bajo <giovannibajo@gcc.gnu.org>
|
||||
|
||||
PR c++/7841
|
||||
* parser.c (cp_parser_direct_declarator): Reject constructor named
|
||||
as qualified template-id.
|
||||
|
||||
2004-06-07 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/15815
|
||||
|
|
|
@ -10766,6 +10766,16 @@ cp_parser_direct_declarator (cp_parser* parser,
|
|||
&& same_type_p (TREE_TYPE (unqualified_name),
|
||||
class_type)))
|
||||
*ctor_dtor_or_conv_p = -1;
|
||||
if (TREE_CODE (declarator) == SCOPE_REF
|
||||
&& TREE_CODE (unqualified_name) == TYPE_DECL
|
||||
&& CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name)))
|
||||
{
|
||||
error ("invalid use of constructor as a template");
|
||||
inform ("use `%T::%D' instead of `%T::%T' to name the "
|
||||
"constructor in a qualified name", class_type,
|
||||
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
|
||||
class_type, class_type);
|
||||
}
|
||||
}
|
||||
|
||||
handle_declarator:;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2004-06-08 Giovanni Bajo <giovannibajo@gcc.gnu.org>
|
||||
|
||||
PR c++/7841
|
||||
* g++.old-deja/g++.pt/ctor2.C: Add error mark.
|
||||
|
||||
2004-06-07 Eric Botcazou <ebotcazou@libertysurf.fr>
|
||||
|
||||
* gcc.dg/union-1.c: New test.
|
||||
|
|
|
@ -8,6 +8,6 @@ struct A {
|
|||
};
|
||||
|
||||
template <class T>
|
||||
A<T>::A<T>()
|
||||
A<T>::A<T>() // { dg-error "invalid use of constructor|qualified name" }
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue