This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48281] [4.6/4.7 Regression] [C++0x] internal compiler error: in record_reference, at cgraphbuild.c:60
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Mar 2011 16:01:30 +0000
- Subject: [Bug c++/48281] [4.6/4.7 Regression] [C++0x] internal compiler error: in record_reference, at cgraphbuild.c:60
- Auto-submitted: auto-generated
- References: <bug-48281-4@http.gcc.gnu.org/bugzilla/>
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;
}