[LLVMbugs] [Bug 9567] New: Argument deduction rejects conversion functions too early

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 26 10:38:12 PDT 2011


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

           Summary: Argument deduction rejects conversion functions too
                    early
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following looks valid:

struct A { 
  template<typename = void> 
  operator int*() { 
    return 0; 
  } 
}; 

int main() { 
  int const* x = A(); 
}


During argument deduction, you are comparing "int*" against "int*" (special
rule to split off constness during argument deduction, but which is really of
no importance here because we don't deduce a template argument from that here).
"int*" can be converted to "int const*" by a qualification conversion, therefor
I believe that argument deduction should succeed and not fail.

Clang says

main1.cpp:10:14: error: no viable conversion from 'A' to 'const int *'
  int const *x = A(); 
             ^   ~~~
main1.cpp:3:3: note: candidate template ignored: failed template argument
deduction                                                                   
  operator int*() { 
  ^
1 error generated.

-- 
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