==================== struct S { constexpr S() {} }; struct T { constexpr T(S const& s) : s{s} {} S const& s; }; constexpr S s {}; constexpr T t { s }; ==================== $ g++ -Wall -std=c++11 constexpr_ref_construct.cpp constexpr_ref_construct.cpp: In constructor ‘constexpr T::T(const S&)’: constexpr_ref_construct.cpp:6:34: internal compiler error: in build_data_member_initialization, at cp/semantics.c:5788 Curiously everything works fine if instead of struct S we typedef S to be an int (or any other intrinsic type).
I get this same error message in a much more complicated situation. I'll simply assume that it's the same thing I'm seeing, but will try to remember running my example through any fix proposed for this issue here.
This is fixed in 4.9.0. I'm adding the testcase and closing the bug.
Author: paolo Date: Tue Apr 29 16:53:27 2014 New Revision: 209905 URL: http://gcc.gnu.org/viewcvs?rev=209905&root=gcc&view=rev Log: 2014-04-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51707 * g++.dg/cpp0x/constexpr-51707.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-51707.C Modified: trunk/gcc/testsuite/ChangeLog
Done.