This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 29080
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 1 Oct 2006 21:34:10 -0700
- Subject: C++ PATCH: PR 29080
- Reply-to: mark at codesourcery dot com
This patch fixes PR c++/29080, a crash on a member template example.
The problem here was that the qualifying name "Left::method" in the
example was being incorrectly treated as "Base::method".
Tested on x86_64-unknown-linux-gnu, applied on the mainline. I will
apply this patch to 4.1, after testing.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
2006-10-01 Mark Mitchell <mark@codesourcery.com>
PR c++/29080
* parser.c (cp_parser_postfix_dot_deref_expression): Use
BASELINK_ACCESS_BINFO as the qualifying scope when calling
adjust_result_of_qualified_name_lookup.
2006-10-01 Mark Mitchell <mark@codesourcery.com>
PR c++/29080
* g++.dg/template/member7.C: New test.
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c (revision 117359)
+++ gcc/cp/parser.c (working copy)
@@ -4593,7 +4593,7 @@ cp_parser_postfix_dot_deref_expression (
}
if (scope && name && BASELINK_P (name))
adjust_result_of_qualified_name_lookup
- (name, BINFO_TYPE (BASELINK_BINFO (name)), scope);
+ (name, BINFO_TYPE (BASELINK_ACCESS_BINFO (name)), scope);
postfix_expression
= finish_class_member_access_expr (postfix_expression, name,
template_p);
Index: gcc/testsuite/g++.dg/template/member7.C
===================================================================
--- gcc/testsuite/g++.dg/template/member7.C (revision 0)
+++ gcc/testsuite/g++.dg/template/member7.C (revision 0)
@@ -0,0 +1,15 @@
+// PR c++/29080
+
+struct Base {
+ template<class C> void method() { }
+};
+
+struct Left : public Base { };
+struct Right : public Base { };
+struct Join : public Left, public Right { };
+
+void function()
+{
+ Join join;
+ join.Left::method<int>();
+}