This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49105] New: [C++0x][SFINAE] ICE during list-initialization of rvalue-references to const
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 21 May 2011 23:29:34 +0000
- Subject: [Bug c++/49105] New: [C++0x][SFINAE] ICE during list-initialization of rvalue-references to const
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@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.