[LLVMbugs] [Bug 15328] Compiler warns about inaccessible copy constructor when binding a reference to a temporary

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 22 13:27:10 PST 2013


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

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> ---
Actually, it does. Per [dcl.init.ref]:

"If the initializer expression is an rvalue, with T2 a class type, and “cv1 T1”
is reference-compatible with “cv2 T2,” the reference is bound in one of the
following ways (the choice is implementation-defined):
  — The reference is bound to the object represented by the rvalue (see 3.10)
or to a sub-object within that object.
  — A temporary of type “cv1 T2” [sic] is created, and a constructor is called
to copy the entire rvalue object into the temporary. The reference is bound to
the temporary or to a sub-object within the temporary.

The constructor that would be used to make the copy shall be callable whether
or not the copy is actually done."

You can lift this restriction with either -std=c++11 or
-Wno-bind-to-temporary-copy.

-- 
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/20130222/348114ad/attachment.html>


More information about the llvm-bugs mailing list