This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48281] [4.6/4.7 Regression] [C++0x] internal compiler error: in record_reference, at cgraphbuild.c:60


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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-30 16:01:21 UTC ---
This was broken by r163893, when I changed finish_compound_literal to always
generate a TARGET_EXPR, rather than use a static variable in some cases.

I could (and probably will) partially revert that to fix this testcase, but
looking into it reveals a deeper bug: we are generally failing to extend the
lifetime of temporaries except in the simplest cases.  In this C++98 testcase
we bind a temporary to the reference member of C, but don't extend its lifetime
as we should.  This is probably pretty rare, but initializer_list subobjects
are likely to be more common.

extern "C" void abort();
bool ok;

struct A {
  A(int) { }
  ~A() { if (!ok) abort(); }
};

struct C
{ 
  const A& ar;
};

int main()
{
  C c = { 1 };
  ok = true;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]