This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member
- From: "mg200 at uni dot brighton.ac.uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 30 Dec 2011 00:26:06 +0000
- Subject: [Bug c++/51707] New: [c++11] constexpr constructor cannot initialize const reference member
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51707
Bug #: 51707
Summary: [c++11] constexpr constructor cannot initialize const
reference member
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mg200@uni.brighton.ac.uk
====================
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).