Skip to content

Template deduction succeeds despite qualifier mismatch #9605

@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 9233
Resolution FIXED
Resolved on Jun 17, 2011 00:32
Version trunk
OS Linux
CC @DougGregor

Extended Description

In this code:

template void f(const T **q);

int main() {
int **p;
f(p);
}

clang deduces T = int, then decides the function is not viable because of the qualifier mismatch. This causes the wrong diagnostic to be issued. [temp.deduct.call]p4, which allows this sort of qualifier mismatch in other cases, says:

"The transformed A can be another pointer or pointer to member type that can be converted to the deduced A via a qualification conversion (4.4)."

But "T **" can't be converted to "const T **" via a qualification conversion.

I noticed this while testing:

int **p;
const auto **q = p;

which also gives the wrong diagnostic, for the same reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions