// { dg-do compile }
// { dg-options "-O2" }

template <typename T> struct F
{
  ~F () {}
  F (T x) {}
};

template <typename T> F<T> foo (const F<T> &x)
{
  return x;
}

static F<int> z = 6;

struct G
{
  G () {}
  F<int> &operator () (F<int> x) { return z; }
};

int
main ()
{
  G g;
  F<int> j (0);
  F<int> f = g (j);
  F<int> h = foo (f);
}

ICEs on both x86_64-linux and i686-linux in set_mem_attributes_minus_bitpos:
1557              gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING
(base_type))
1558                          || DECL_ARTIFICIAL (base));
base_type here needs constructing (it is variable z).
Compiles just fine with 4.1.x or 4.2.x.


-- 
           Summary: [4.3 regression] ICE in set_mem_attributes
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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

Reply via email to