public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56913] New: [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers
@ 2013-04-11  0:55 ai.azuma at gmail dot com
  2013-04-11 16:06 ` [Bug c++/56913] " paolo.carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: ai.azuma at gmail dot com @ 2013-04-11  0:55 UTC (permalink / raw)
  To: gcc-bugs


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<typename T>
T &&declval();

template<typename T, typename U,
         typename = decltype((declval<T>().*declval<U>())())>
constexpr bool test(int)
{
  return true;
}

template<typename T, typename U>
constexpr bool test(...)
{
  return false;
}

struct S
{};

static_assert(!test<S, void (S::*)() &>(0), "");
static_assert(test<S, void (S::*)() &&>(0), "");
static_assert(test<S &, void (S::*)() &>(0), "");
static_assert(!test<S &, void (S::*)() &&>(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<T>().*declval<U>())())>
                                           ^
main.cpp:20:1: error: static assertion failed: 
 static_assert(!test<S, void (S::*)() &>(0), "");
 ^
main.cpp:5:43: error: pointer-to-member-function type 'void (S::*)() &&'
requires an rvalue
          typename = decltype((declval<T>().*declval<U>())())>
                                           ^
main.cpp:23:1: error: static assertion failed: 
 static_assert(!test<S &, void (S::*)() &&>(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.


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

* [Bug c++/56913] [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers
  2013-04-11  0:55 [Bug c++/56913] New: [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers ai.azuma at gmail dot com
@ 2013-04-11 16:06 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-11 16:06 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-11 16:05:57 UTC ---
Fixed mainline and 4.8.1.


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

end of thread, other threads:[~2013-04-11 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11  0:55 [Bug c++/56913] New: [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers ai.azuma at gmail dot com
2013-04-11 16:06 ` [Bug c++/56913] " paolo.carlini at oracle dot com

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).