[Bug c++/53094] constexpr vector subscripting

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 3 19:53:00 GMT 2012


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

--- Comment #10 from Marc Glisse <glisse at gcc dot gnu.org> 2012-12-03 19:52:39 UTC ---
Created attachment 28864
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28864
minimal cumulative patch for comment #9

(In reply to comment #9)
> adding  it "helps"
>    t = build_constructor (TREE_TYPE (t), n);
> +  if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
> +    t = fold (t);
>    TREE_CONSTANT (t) = true;

I would have put it after TREE_CONSTANT, but that's not the problem.

> unfortunately generates ICE for the class constructor at cp/tree.c:2712

Indeed, cp_tree_equal is missing a VECTOR_CST case. We can likely just forward
to operand_equal_p.

With this patch (I am not proposing it, it conflicts with Jakub's), your last
code compiles.



More information about the Gcc-bugs mailing list