Created attachment 33983 [details] preprocessed source file Internal compiler error in static assert of constexpr forwarding xvalue container member rvalue reference. g++ 4.8 and 4.9 passes, but trunk built from r217559 on ubuntu 14.04 fails compilation with $ g++-trunk -std=c++11 -Wall -Wextra constexpr_static_assert.ii constexpr_static_assert.cpp:50:39: in constexpr expansion of ‘get<0, S<int&&> >((* & S<int&&>((* &1))))’ constexpr_static_assert.cpp:35:35: in constexpr expansion of ‘__get<0, T>::value<S<int&&>&&>((* & std::forward<S<int&&> >((* & arg))))’ constexpr_static_assert.cpp:50:44: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:1779 static_assert (get <0> (S <int &&> (1)) == 1, ""); // g++ 4.9 passes, g++ trunk r217559 fails ... /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // source // #include <utility> using namespace std; /////////////////////////////////////////////////////////////////////////////// template <typename C> struct member_forward { typedef typename remove_reference <C>::type::type T; typedef typename conditional < is_lvalue_reference <C &&>::value && not is_reference <T>::value, typename add_lvalue_reference <T>::type, T >::type type; }; template <typename C> using member_forward_t = typename member_forward <C>::type; /////////////////////////////////////////////////////////////////////////////// template <int , typename > struct __get; template < typename T> struct __get <0, T> { constexpr static auto value (T arg) -> decltype ((forward <member_forward_t <T>> (arg.t))) { return forward <member_forward_t <T>> (arg.t); } }; template <int N, typename T> constexpr auto get (T && arg) -> decltype (__get <N, T &&>::value (forward <T> (arg))) { return __get <N, T &&>::value (forward <T> (arg)); } /////////////////////////////////////////////////////////////////////////////// template <typename T> struct S { typedef T type; T t; template <typename U> constexpr S (U && u) : t (forward <U> (u)) {} }; /////////////////////////////////////////////////////////////////////////////// static_assert (get <0> (S <int &&> (1)) == 1, ""); // g++ 4.9 passes, g++ trunk r217559 fails int main () {} /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
Author: jason Date: Wed Nov 19 22:06:26 2014 New Revision: 217815 URL: https://gcc.gnu.org/viewcvs?rev=217815&root=gcc&view=rev Log: PR c++/63885 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't complain yet about a reference. [TARGET_EXPR]: Handle TARGET_EXPR with addr == true. [ADDR_EXPR]: Make sure we don't take the address of a CONSTRUCTOR. (cxx_bind_parameters_in_call): In the new scheme addr is always false. * typeck.c (build_address): Don't take the address of a CONSTRUCTOR. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-ref8.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c trunk/gcc/cp/typeck.c
Fixed.
I tested the latest revision this morning and all my tests passed. Thanks!