This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 34776
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 17 Jan 2008 19:22:11 +0100
- Subject: [C++ Patch] PR 34776
Hi,
I have this tiny patch, which just avoids calling constructor_name_p
when doesn't make sense. Alternately, would also work robustifying
constructor_name_p itself, but I'm not sure we want to do that because
most uses are guaranteed safe,
Tested x86_64-linux. Ok for mainline?
Paolo.
//////////////////
/cp
2008-01-17 Paolo Carlini <pcarlini@suse.de>
PR c++/34776
* name-lookup.c (do_class_using_decl): Do not call constructor_name_p
on non-class type scope.
/testsuite
2008-01-17 Paolo Carlini <pcarlini@suse.de>
PR c++/34776
* g++.dg/template/crash75.C: New.
Index: testsuite/g++.dg/template/crash75.C
===================================================================
*** testsuite/g++.dg/template/crash75.C (revision 0)
--- testsuite/g++.dg/template/crash75.C (revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/34776
+
+ template<typename T> struct A
+ {
+ T::X<0> x; // { dg-error "non-template|T::template|base type" }
+ };
+
+ A<int*> a;
Index: cp/name-lookup.c
===================================================================
*** cp/name-lookup.c (revision 131599)
--- cp/name-lookup.c (working copy)
*************** do_class_using_decl (tree scope, tree na
*** 2824,2830 ****
error ("%<%T::%D%> names destructor", scope, name);
return NULL_TREE;
}
! if (constructor_name_p (name, scope))
{
error ("%<%T::%D%> names constructor", scope, name);
return NULL_TREE;
--- 2824,2830 ----
error ("%<%T::%D%> names destructor", scope, name);
return NULL_TREE;
}
! if (CLASS_TYPE_P (scope) && constructor_name_p (name, scope))
{
error ("%<%T::%D%> names constructor", scope, name);
return NULL_TREE;