[LLVMbugs] [Bug 8750] New: Incorrect OR of conversion function templates against non-template conversion functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 6 21:25:14 PST 2010


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

           Summary: Incorrect OR of conversion function templates against
                    non-template conversion functions
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Clang accepts the following code

void f(int); 
void f(long); 

struct A { 
  template<typename T> operator T(); 
  operator long(); 
};

int main() {
  f(A());
}

However it's supposed to reject it: For the first f, you end up using the
"operator T<int>" (since int -> int is better than long -> int), and for the
second f, you end up using the non-template operator long (since it's a
non-template, it's preferred over the function template specialization). 

The two user defined conversion sequences created aren't comparable because
they don't use the same conversion function. So the call is ambiguous.

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