https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63885
Bug ID: 63885 Summary: ICE in static assert of constexpr forwarding xvalue container member rvalue reference Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: listcrawler at gmail dot com Created attachment 33983 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33983&action=edit 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 () {} /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////