public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49105] New: [C++0x][SFINAE] ICE during list-initialization of rvalue-references to const
@ 2011-05-21 23:41 daniel.kruegler at googlemail dot com
  2011-05-23 18:00 ` [Bug c++/49105] " jason at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-05-21 23:41 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-29  0:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-21 23:41 [Bug c++/49105] New: [C++0x][SFINAE] ICE during list-initialization of rvalue-references to const daniel.kruegler at googlemail dot com
2011-05-23 18:00 ` [Bug c++/49105] " jason at gcc dot gnu.org
2011-05-23 23:20 ` jason at gcc dot gnu.org
2011-05-23 23:22 ` jason at gcc dot gnu.org
2011-05-25  1:38 ` jason at gcc dot gnu.org
2011-05-25  2:10 ` jason at gcc dot gnu.org
2011-05-29  1:17 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).