This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, 3.4] Fix PR c++/20552
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Thu, 08 Dec 2005 14:55:21 +0100 (CET)
- Subject: [patch, 3.4] Fix PR c++/20552
The following patch fixes an ice-on-invalid-code on the 3.4 branch
(see testcase below).
We didn't diagnose the error in the code and crashed later.
The patch just removes the broken logic to prevent duplicate
error messages.
The patch is a backport of a small part from Mark's patch
http://gcc.gnu.org/ml/gcc-cvs/2004-03/msg00427.html
(Don't let the cvs log message confuse you, it's wrong -
read the ChangeLog instead.)
Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for the 3.4 branch?
Testcase OK for 4.0 branch up to mainline?
Regards,
Volker
:ADDPATCH C++:
2005-12-08 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/20552
Backport:
2004-03-08 Mark Mitchell <mark@codesourcery.com>
* decl.c (duplicate_decls): Don't check IDENTIFIER_ERROR_LOCUS.
===================================================================
--- gcc/gcc/cp/decl.c (revision 108100)
+++ gcc/gcc/cp/decl.c (working copy)
@@ -1380,10 +1380,7 @@
else
return NULL_TREE;
}
-
- /* Already complained about this, so don't do so again. */
- else if (current_class_type == NULL_TREE
- || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type)
+ else
{
error ("conflicting declaration '%#D'", newdecl);
cp_error_at ("'%D' has a previous declaration as `%#D'",
===================================================================
2005-12-08 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/20552
* g++.dg/ext/typeof10.C: New test.
===================================================================
--- gcc/gcc/testsuite/g++.dg/ext/typeof10.C 2005-08-29 00:25:44 +0200
+++ gcc/gcc/testsuite/g++.dg/ext/typeof10.C 2005-12-08 03:08:34 +0100
@@ -0,0 +1,11 @@
+// PR c++/20552
+// Origin: Ivan Godard <igodard@pacbell.net>
+
+template<int> struct A
+{
+ void foo()
+ {
+ typedef int T; // { dg-error "previous" }
+ typedef __typeof__(*this) T; // { dg-error "conflicting" }
+ }
+};
===================================================================