C++ Logo


Advanced search

Surrogate calls with cv-qualifiers

From: Jason Cobb <jason.e.cobb_at_[hidden]>
Date: Fri, 28 Jun 2019 14:40:51 -0400
[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

Received on 2019-06-28 13:42:45