[llvm-bugs] [Bug 42317] explicit refuses the call to other implicit constructors

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 20 17:56:20 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42317

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

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

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
"return r;" implicitly invokes the copy constructor of B to copy the return
value. You made that constructor explicit, so it can't be implicitly invoked
any more. Most of your example is an irrelevant distraction; the relevant part
is:

struct B {
    B();
    explicit B(B const &);
};

B f() { 
    B r;
    return r;  // error, can't return B here because there is no implicit copy
constructor
}

-- 
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/20190621/cbe9bec1/attachment.html>


More information about the llvm-bugs mailing list