This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 36404
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 02 Jun 2008 14:06:23 +0200
- Subject: [C++ Patch] PR 36404
Hi,
a patchlet for a simple ICE on invalid. I also checked that the EDG
front-end errors out in a similar way and exactly at the same lines both
for the new testcase and the amended old one.
Regtested x86_64-linux. Ok for mainline?
Paolo.
///////////////////
/cp
2008-06-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/36404
* pt.c (push_template_decl_real): Consistently return error_mark_node
on error.
/testsuite
2008-06-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/36404
* g++.dg/template/crash79.C: New.
* g++.dg/other/pr28114.C: Adjust.
Index: testsuite/g++.dg/other/pr28114.C
===================================================================
*** testsuite/g++.dg/other/pr28114.C (revision 136271)
--- testsuite/g++.dg/other/pr28114.C (working copy)
*************** template<int> void foo(struct {}*); // {
*** 5,9 ****
void bar()
{
! foo<0>(0); // { dg-error "" }
}
--- 5,9 ----
void bar()
{
! foo<0>(0);
}
Index: testsuite/g++.dg/template/crash79.C
===================================================================
*** testsuite/g++.dg/template/crash79.C (revision 0)
--- testsuite/g++.dg/template/crash79.C (revision 0)
***************
*** 0 ****
--- 1,9 ----
+ // PR c++/36404
+
+ struct A
+ {
+ A(int);
+ template<int> enum { e }; // { dg-error "template" }
+ };
+
+ A a(A::e); // { dg-error "not a member" }
Index: cp/pt.c
===================================================================
*** cp/pt.c (revision 136271)
--- cp/pt.c (working copy)
*************** push_template_decl_real (tree decl, bool
*** 3791,3797 ****
member_template_p = true;
if (TREE_CODE (decl) == TYPE_DECL
&& ANON_AGGRNAME_P (DECL_NAME (decl)))
! error ("template class without a name");
else if (TREE_CODE (decl) == FUNCTION_DECL)
{
if (DECL_DESTRUCTOR_P (decl))
--- 3791,3800 ----
member_template_p = true;
if (TREE_CODE (decl) == TYPE_DECL
&& ANON_AGGRNAME_P (DECL_NAME (decl)))
! {
! error ("template class without a name");
! return error_mark_node;
! }
else if (TREE_CODE (decl) == FUNCTION_DECL)
{
if (DECL_DESTRUCTOR_P (decl))