[LLVMbugs] [Bug 13539] New: use of overloaded operator '+' is ambiguous if a template conversion operator also exists

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 6 12:28:19 PDT 2012


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

             Bug #: 13539
           Summary: use of overloaded operator '+' is ambiguous if a
                    template conversion operator also exists
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pichet2000 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Both MSVC and gcc (4.5.0) handle the following code.
clang will give :
error: use of overloaded operator '+' is ambiguous

======
template <typename T>
struct C
{
   operator T();
   template <typename U> operator U();
};

void f(C<int> obj) 
{
    int x = obj + 1;
}
======

Is clang right or wrong?

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