From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6635 invoked by alias); 11 Apr 2013 00:55:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6441 invoked by uid 48); 11 Apr 2013 00:55:35 -0000 From: "ai.azuma at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56913] New: [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers Date: Thu, 11 Apr 2013 00:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: ai.azuma at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg00877.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56913 Bug #: 56913 Summary: [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: ai.azuma@gmail.com Created attachment 29851 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29851 Output of -v option and preprocessed source GCC 4.8.1 20130404 and 4.9.0 20130407 reject the following well-formed code; //----------------------------------------------------------- template T &&declval(); template().*declval())())> constexpr bool test(int) { return true; } template constexpr bool test(...) { return false; } struct S {}; static_assert(!test(0), ""); static_assert(test(0), ""); static_assert(test(0), ""); static_assert(!test(0), ""); //----------------------------------------------------------- For the above code, GCC 4.9.0 20130407 complains as follows; main.cpp:5:43: error: pointer-to-member-function type 'void (S::*)() &' requires an lvalue typename = decltype((declval().*declval())())> ^ main.cpp:20:1: error: static assertion failed: static_assert(!test(0), ""); ^ main.cpp:5:43: error: pointer-to-member-function type 'void (S::*)() &&' requires an rvalue typename = decltype((declval().*declval())())> ^ main.cpp:23:1: error: static assertion failed: static_assert(!test(0), ""); ^ SFINAE does not seem to be applied to ill-formed pointer-to-member operators (as per N3485 [expr.mptr.oper]/6) instantiated in the first and fourth static_asserts, and they result in hard errors.