Page MenuHomePhabricator

Fixed pointer to const& member function on rvalues, P0704r1

Authored by Rakete1111 on Aug 17 2017, 5:38 PM.



This patch allows pointer to const& member functions on rvalues for C++20, and as an extension for prior versions. This is P0704r1.

Diff Detail

Event Timeline

Rakete1111 created this revision.Aug 17 2017, 5:38 PM
rsmith edited edge metadata.Aug 17 2017, 6:06 PM



I would be inclined to use an Extension rather than an ExtWarn for this. (I really don't see why we didn't move this as a DR -- it seems to be obviously a defect rather than an extension to me.)


Hmm, this seems hard to express clearly and concisely. How about something like:

"invoking a pointer to a 'const &' member function on an rvalue is a C++2a extension"


Please mark this as SFINAEFailure too; if we're going to reject under -pedantic-errors, we should also treat it as SFINAEable.

Oh, and you'll need an accompanying test case before this can be committed (look at the existing tests in test/SemaCXX for ideas).

Thanks! Agreed, your wording is better than mine :)

Thanks, will you need someone to commit this for you?

794 ↗(On Diff #111602)

We've historically avoided using precise year numbers until a standard is finalized. I would call this CXX2a for now, and only provide the c++2a-extensions spelling, just in case the next standard ships a year late (or early).


Please also update this to match the prior diagnostic's text.


This should now be in a CXXPre2aCompatPedantic group, because the corresponding extension is a pedantic warning.

Rakete1111 marked 3 inline comments as done.

Yes please.

Rebased because another commit already added the definitions of the C++20 groups.

Rakete1111 marked 2 inline comments as done.

Update entry on the C++ status page.

rsmith accepted this revision.Aug 24 2017, 6:31 PM

Sorry for the delay, this looks good to me.

This revision is now accepted and ready to land.Aug 24 2017, 6:31 PM
rsmith closed this revision.Aug 24 2017, 6:49 PM

Committed as r311744.