http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49105

           Summary: [C++0x][SFINAE] ICE during list-initialization of
                    rvalue-references to const
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com
                CC: ja...@redhat.com


gcc 4.7.0 20110514 (experimental) in C++0x mode produces an internal compiler
error when compiling this code at the line marked with #:

//----
template<class T, class = decltype(T{})>
char f(int);

template<class T>
auto f(...) -> char(&)[2];

static_assert(sizeof(f<const int&&>(0)) == 1, "Error"); // #
//----

"internal compiler error: in cp_build_c_cast, at cp/typeck.c:6442|"

The code should be accepted.

Further tests provided evidence that we need an value-initialization of an
rvalue reference to const T to reproduce the ICE, even though the sole
initialization written as 

const int&& rri{};

does not cause the same kind of problem. This is odd, because the functional
cast T{} has exactly the same semantics as the corresponding
direct-list-initialization.

Additionally, the same error occurs, when the list has one element, e.g. the
expression T{0} results in the same kind of error.

Reply via email to