C++ Logo


Advanced search

Subject: Surrogate calls with cv-qualifiers
From: Jason Cobb (jason.e.cobb_at_[hidden])
Date: 2019-06-28 13:40:51

[I first wrote about this in an editorial PR on
https://github.com/cplusplus/draft/pull/2912, the proposed fix for this
issue was rejected on the grounds of not being clearly editorial,
although another fix in this paragraph was accepted.]

In [over.call.object]/2, the Standard describes surrogate calls. It
specifies that conversion functions with a specific /conversion-type-id/
can generate surrogate calls if the /conversion-type-id/ matches

- the type “pointer to function of (P1,…,Pn) returning R”, or

- the type “reference to pointer to function of (P1,…,Pn) returning R”, or

- the type “reference to function of (P1,…,Pn) returning R”

My issue with this is that it ignores possible cv-qualifiers on the
first two of these types (and also noexcept-ness). Existing practice on
all of GCC, Clang, MSVC, and ICC in pedantic (/permissive- for MSVC)
mode accept cv-qualified and noexcept return types.

Is this a defect?

[It's possible that this is a duplicate of CWG2189, but there is no
actual description of it on

Jason Cobb

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups