[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-12 Thread glisse at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055



--- Comment #10 from Marc Glisse glisse at gcc dot gnu.org 2012-10-12 
14:14:46 UTC ---

Author: glisse

Date: Fri Oct 12 14:14:37 2012

New Revision: 192401



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=192401

Log:

2012-10-12  Marc Glisse  marc.gli...@inria.fr



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.





Added:

trunk/gcc/testsuite/g++.dg/pr53055.C   (with props)

Modified:

trunk/gcc/c-family/ChangeLog

trunk/gcc/c-family/c-common.h

trunk/gcc/cp/ChangeLog

trunk/gcc/cp/call.c

trunk/gcc/cp/typeck.c

trunk/gcc/testsuite/ChangeLog



Propchange: trunk/gcc/testsuite/g++.dg/pr53055.C

('svn:eol-style' added)



Propchange: trunk/gcc/testsuite/g++.dg/pr53055.C

('svn:keywords' added)


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-12 Thread glisse at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055



Marc Glisse glisse at gcc dot gnu.org changed:



   What|Removed |Added



 CC||glisse at gcc dot gnu.org



--- Comment #11 from Marc Glisse glisse at gcc dot gnu.org 2012-10-12 
14:21:18 UTC ---

(In reply to comment #7)

 Then I'll take care of the column number asap.



Ok, your turn ;-)



(In reply to comment #9)

 I will be happy

 with the text changed to left-side operand of %-*% must a pointer to class

 compatible with the right-side operand,



I went with: left hand operand of -* must be a pointer to class, but is a

pointer to member of type ..., the bit about the RHS didn't seem relevant to

this particular error. But you still have a chance to convince Paolo for the

follow-up patch...


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-12 Thread paolo.carlini at oracle dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055



Paolo Carlini paolo.carlini at oracle dot com changed:



   What|Removed |Added



 Status|NEW |RESOLVED

 CC|marc.glisse at normalesup   |

   |dot org |

 Resolution||FIXED



--- Comment #12 from Paolo Carlini paolo.carlini at oracle dot com 2012-10-12 
14:35:53 UTC ---

Great. This is fixed anyway.


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-11 Thread paolo.carlini at oracle dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055



--- Comment #5 from Paolo Carlini paolo.carlini at oracle dot com 2012-10-11 
17:22:00 UTC ---

If the patch otherwise works fine, I would encourage you to submit it anyway

even if the caret isn't accurate: AFAICS, for all the errors emitted by that

function the caret is at the end of the expression and fixing that may be

conceptually simple but I don't think boils down to 10 or 20 lines, it seems a

separate issue really.


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-11 Thread manu at gcc dot gnu.org

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #6 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-10-11 
17:55:50 UTC ---
Sorry, I think your message is not easily understandable. I think you are
trying to say that the right hand side must be a pointer-to-member, but this
is not actually what your proposed message says.

I like more clang's message:

/tmp/webcompile/_28618_0.cc:4:11: error: right hand operand to -* has non
pointer-to-member type 'void ()'
int i = p -* f ;
  ^   ~

I am not saying that you need to print the type or fix the location (it would
be nice but I understand it is quite extra work, and could be done later). But
the text could say: type of right-side operand of %-*% is not
pointer-to-member, or right-side operand of %-*% has non pointer-to-member
type or right-side operand of %-*% must have pointer-to-member type.


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-11 Thread paolo.carlini at oracle dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055



--- Comment #7 from Paolo Carlini paolo.carlini at oracle dot com 2012-10-11 
18:08:23 UTC ---

As long as we avoid the ICE and the message is fine I'm happy. Then I'll take

care of the column number asap.


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-11 Thread glisse at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055



--- Comment #8 from Marc Glisse glisse at gcc dot gnu.org 2012-10-11 18:16:58 
UTC ---

Note: this is very old, I barely remember it.



(In reply to comment #6)

 Sorry, I think your message is not easily understandable. I think you are

 trying to say that the right hand side must be a pointer-to-member,



No, I think I am saying: hello, this is the left hand side of a -* operator,

and you are feeding me a pointer to member, which obviously should be on the

right hand side.



 I like more clang's message:

 

 /tmp/webcompile/_28618_0.cc:4:11: error: right hand operand to -* has non

 pointer-to-member type 'void ()'

 int i = p -* f ;

   ^   ~



The testcase in the patch has p -* p, and clang says:



test.cc:2:11: error: left hand operand to -* must be a pointer to class

  compatible with the right hand operand, but is 'struct  A::*'

int i = p -* p ; // { dg-error  }

  ^~~

  .*



(not sure what that .* is doing there)



 I am not saying that you need to print the type or fix the location (it would

 be nice but I understand it is quite extra work, and could be done later). But

 the text could say: type of right-side operand of %-*% is not

 pointer-to-member, or right-side operand of %-*% has non 
 pointer-to-member

 type or right-side operand of %-*% must have pointer-to-member type.



IIRC (and I could be wrong), this test is really about the lhs. Which doesn't

mean that the error message is good...


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-10-11 Thread manu at gcc dot gnu.org

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

--- Comment #9 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-10-11 
18:27:00 UTC ---
(In reply to comment #8)
 Note: this is very old, I barely remember it.
 
 (In reply to comment #6)
  Sorry, I think your message is not easily understandable. I think you are
  trying to say that the right hand side must be a pointer-to-member,
 
 No, I think I am saying: hello, this is the left hand side of a -* operator,
 and you are feeding me a pointer to member, which obviously should be on the
 right hand side.

Ah! I was looking at the testcase here and I got confused.

 test.cc:2:11: error: left hand operand to -* must be a pointer to class
   compatible with the right hand operand, but is 'struct  A::*'
 int i = p -* p ; // { dg-error  }
   ^~~
   .*
 
 (not sure what that .* is doing there)

Me neither, but clang's text is clearer in my humble opinion. I will be happy
with the text changed to left-side operand of %-*% must a pointer to class
compatible with the right-side operand, and everything the same as your
current patch. Please submit that!


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-05-12 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

--- Comment #4 from Marc Glisse glisse at gcc dot gnu.org 2012-05-12 23:33:16 
UTC ---
Created attachment 27390
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27390
patch 1

ice.cc:2:15: error: pointer to member must be on the right side of '-*'
 int i = p -* p ;
   ^

so the caret is on the wrong side of the operator.


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-04-20 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

--- Comment #1 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-20 
14:08:31 UTC ---
Created attachment 27204
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27204
unincluded testcase

4.4 rejects it:

part-combine-iterator.cc: In member function 'virtual void
Part_combine_iterator::derived_mark() const':
part-combine-iterator.cc:173: error: invalid use of '' on pointer to member

4.5 also ICEs the same way.


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-04-20 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

Marc Glisse marc.glisse at normalesup dot org changed:

   What|Removed |Added

 CC||marc.glisse at normalesup
   ||dot org

--- Comment #2 from Marc Glisse marc.glisse at normalesup dot org 2012-04-20 
14:44:29 UTC ---
A brutal application of delta gives this short but non-sensical code:

void f () ;
struct A A :: * p ;
int i = p -* f ;


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-04-20 Thread feedback at launchpad dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

--- Comment #3 from Launchpad feedback at launchpad dot net 2012-04-20 
14:44:50 UTC ---
David Kastrup added the following comment to Launchpad bug report 984577:

Just for the record: the source code triggering the error is invalid C++.  It
is just that an internal compiler error is a somewhat intimidating diagnostic.

-- 
http://launchpad.net/bugs/984577


[Bug c++/53055] ICE in cp_build_indirect_ref, at cp/typeck.c:2836

2012-04-20 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53055

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-04-20
 Ever Confirmed|0   |1