[LLVMbugs] [Bug 13018] Overloaded operators not in the overload set, if argument-type is strongly-typed-enum

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 4 17:45:21 PDT 2012


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|                            |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> 2012-06-04 19:45:21 CDT ---
Clang is behaving correctly, according to the standard.

[over.match.oper]p3: "If no operand has a class type, only those non-member
functions in the lookup set that have a first parameter of type T1 [...] when
T1 is an enumeration type, or [...] a second parameter of type T2 [...] when T2
is an enumeration type, are candidate functions."

Your operator|(Bar,Bar) is not a candidate because neither argument is of type
Foo. You'll need to write additional overloads:

Bar operator~(Foo f) { return ~Bar(f); }
Bar operator|(Foo f1, Foo f2) { return Bar(f1) | Bar(f2); }

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