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: unassig...@gcc.gnu.org
        ReportedBy: mg...@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).

Reply via email to