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



--- Comment #7 from fabien at gcc dot gnu.org 2013-02-25 20:56:42 UTC ---

(In reply to comment #6)

> (In reply to comment #4)

[...]

> If so, this corrected test case still triggers ICE:



Good point. Further reduced:



struct A

{

    virtual int String ();

};



class F: public A { };



struct G

{

  F value;

};



class D

{

  template <int>

  void Verify()

  {

    G x;

    F& name = x.value;

    name.String();

  }

};



I restarted the analysis from the beginning. My fix for c++/11750 was basically

to restrict the cases where the unsafe front-end de-virtualization was done. It

wouldn't help to refine that change because anyway, it would still be possible

to find a testcase that shows the same ICE.



My attempts to fix the problem on the constexpr side failed probably because it

is correct.



The problem is more related to the COMPONENT_REF 'G'. Probably because

D::Verify is not instantiated yet, the field 'value' of G is still an

IDENTIFIER_NODE instead of being a FIELD_DECL, which leads to a crash while

calling DECL_FIELD_IS_BASE.



Hence, I can only see two solutions:

1) make 'value' a FIELD_DECL before or during the

fold_non_dependent_expr_sfinae call. Not sure it is simple.

2) check that the first operand of a COMPONENT_REF is actually a FIELD_DECL

before calling DECL_FIELD_IS_BASE on it.



Upcoming patch for the solution 2 on gcc-patch...

Reply via email to