[LLVMbugs] [Bug 8130] New: Clang fails to partially order overloaded operators correctly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 11 15:45:27 PDT 2010


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

           Summary: Clang fails to partially order overloaded operators
                    correctly
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: faisalv at yahoo.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Clang fails to partially order overloaded operators correctly.

Here is an example that clang fails to compile, from the standard (n3126-C++0x
FCD): 14.5.6.2 [temp.func.order] p3

struct A { };

template<class T> struct B {
   template<class R> int operator*(R&); // #1
};

template<class T, class R> int operator*(T&, R&); // #2
// The declaration of B::operator* is transformed into the equivalent of
// template<class R> int operator*(B<A>&, R&); // #1a
int main() {
  A a;
  B<A> b;
  b * a; // calls #1a
}

clang -cc1 test.cpp

test.cpp:13:3: error: use of overloaded operator '*' is ambiguous
b * a; // calls #1a
~ ^ ~
test.cpp:4:23: note: candidate function [with $0 = A]
template<class R> int operator*(R&); // #1
                      ^
test.cpp:7:32: note: candidate function [with T = B<A>, R = A]
template<class T, class R> int operator*(T&, R&); // #2
                               ^
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