Skip to content

CWG2978 [temp.deduct.call] Deduction and qualification conversions with references #651

@t3nsor

Description

@t3nsor

Full name of submitter: Brian Bi

Issue description: There is implementation divergence in the treatment of the following deduction:

#include <cstddef>

template <std::size_t N>
void f(const int* const (&)[N]);

int main() {
    int* a[3];
    f(a);
}

It is not clear whether bullet 4.1 of [temp.deduct.call] allows qualification conversions.

Suggested resolution: Edit [temp.deduct.call]/4.1 as follows:

If the original P is a reference type, the deduced A (i.e., the type referred to by the reference) can be more cv-qualified a type other than the transformed A that is reference-compatible ([dcl.init.ref]) with the transformed A.

(We might not need to say "transformed", actually. As far as I can tell, when the original P is a reference type, we transform A only in the case where P is a forwarding reference, and in that case no difference in cv-qualification is possible.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions