From 5e54f81df1b2336a3ddc4f77180f4e579436b663 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Fri, 12 Oct 2012 16:14:37 +0200 Subject: [PATCH] re PR c++/53055 (ICE in cp_build_indirect_ref, at cp/typeck.c:2836) 2012-10-12 Marc Glisse PR c++/53055 gcc/c-family/ * c-common.h (enum ref_operator) [RO_ARROW_STAR]: New. gcc/cp/ * call.c (build_new_op_1): Pass RO_ARROW_STAR to cp_build_indirect_ref. * typeck.c (cp_build_indirect_ref): Handle RO_ARROW_STAR. gcc/testsuite/ * g++.dg/pr53055.C: New testcase. From-SVN: r192401 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-common.h | 4 +++- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/call.c | 2 +- gcc/cp/typeck.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr53055.C | 5 +++++ 7 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr53055.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 04b6971fef7..c740e449383 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2012-10-12 Marc Glisse + + PR c++/53055 + * c-common.h (enum ref_operator) [RO_ARROW_STAR]: New. + 2012-10-11 Eric Botcazou * c-ada-spec.c (dump_ada_template): Bail out for template declarations diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index cb18b4e0747..66d90a34570 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -477,7 +477,9 @@ typedef enum ref_operator { /* -> */ RO_ARROW, /* implicit conversion */ - RO_IMPLICIT_CONVERSION + RO_IMPLICIT_CONVERSION, + /* ->* */ + RO_ARROW_STAR } ref_operator; /* Information about a statement tree. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 549ddbdc319..ad765412832 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-10-12 Marc Glisse + + PR c++/53055 + * call.c (build_new_op_1): Pass RO_ARROW_STAR to cp_build_indirect_ref. + * typeck.c (cp_build_indirect_ref): Handle RO_ARROW_STAR. + 2012-10-11 Jason Merrill * cp-tree.h (DECL_THUNKS): NULL_TREE for non-virtual functions. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 3351a585f2b..c94bbbe3c08 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5309,7 +5309,7 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1, return cp_build_array_ref (input_location, arg1, arg2, complain); case MEMBER_REF: - return build_m_component_ref (cp_build_indirect_ref (arg1, RO_NULL, + return build_m_component_ref (cp_build_indirect_ref (arg1, RO_ARROW_STAR, complain), arg2, complain); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 13e75ab9ebf..eaa0935dc98 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2908,6 +2908,10 @@ cp_build_indirect_ref (tree ptr, ref_operator errorstring, case RO_IMPLICIT_CONVERSION: error ("invalid use of implicit conversion on pointer to member"); break; + case RO_ARROW_STAR: + error ("left hand operand of %<->*%> must be a pointer to class, " + "but is a pointer to member of type %qT", type); + break; default: gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f3d29906f9..3b9f121baea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-12 Marc Glisse + + PR c++/53055 + * g++.dg/pr53055.C: New testcase. + 2012-10-12 Paolo Carlini PR c++/52744 diff --git a/gcc/testsuite/g++.dg/pr53055.C b/gcc/testsuite/g++.dg/pr53055.C new file mode 100644 index 00000000000..787af9d156f --- /dev/null +++ b/gcc/testsuite/g++.dg/pr53055.C @@ -0,0 +1,5 @@ +// PR c++/53055 +// { dg-do compile } + +struct A A :: * p ; +int i = p ->* p ; // { dg-error "" } -- 2.30.2