[LLVMbugs] [Bug 11766] clang c++ ambigious conversion by constructor and operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 3 17:42:44 PDT 2012


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

Douglas Gregor <dgregor at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #4 from Douglas Gregor <dgregor at apple.com> 2012-04-03 19:42:44 CDT ---
(In reply to comment #3)
> (In reply to comment #1)
> > The conversion isn't ambiguous; note that both g++ and EDG also accept those
> > code.
> 
> At dinkumware.com exam g++ doesn't accept those code. I don't understand why it
> isn't ambiguous. We have two ways of doing conversion. Which compiler should
> choose ? What will programmer think about it. For me it will be very surprising
> to findout that compiler choose 1 way and not the other.

By my reading of the standard, operator Apple() is preferred because one
doesn't need to add 'const' to make the call to operator Apple(), while one
does have to add 'const' to call the Apple(const Orange&) constructor. Drop the
'const' on the constructor and all compilers reject it with an ambiguity.

Please do not re-open this bug unless you find that my reading of the C++
standard is incorrect.

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