[LLVMbugs] [Bug 9233] New: Template deduction succeeds despite qualifier mismatch

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 16 05:21:48 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9233

           Summary: Template deduction succeeds despite qualifier mismatch
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


In this code:

template<typename T> 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 qualiļ¬cation 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.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list