[LLVMbugs] [Bug 22370] Conversion to T&& via user-defined conversion to const T rejected

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 28 11:42:28 PST 2015


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

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> ---
Here's an example from the C++ standard, which is (up to naming) identical to
your attachment:

struct Banana { };
struct Enigma { operator const Banana(); };
Banana &&banana2 = Enigma(); // ill-formed

This was made ill-formed by the resolution of a DR (bugfix) applied
retroactively to C++11:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1604

This agrees with the usual rule in C++: you only get one user-defined
conversion in an initialization; you don't get to call both Enigma::operator
const Banana() *and* the Banana copy constructor here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150128/81b73ed6/attachment.html>


More information about the llvm-bugs mailing list