[LLVMbugs] [Bug 16042] New: Weird behavior of implicit copy ctor with c++11

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 16 16:01:43 PDT 2013


            Bug ID: 16042
           Summary: Weird behavior of implicit copy ctor with c++11
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gael.guennebaud at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10534
  --> http://llvm.org/bugs/attachment.cgi?id=10534&action=edit
Demonstration of the issue

The attached example produces the following error when compiled with

error: no viable conversion from 'Foo' to 'Bar'
note: candidate constructor (the implicit copy constructor) not viable: no
known conversion from 'Foo' to 'const Bar &' for 1st argument

However, it does compile fine if the default copy ctor is explicitly defined
with (line 6):

Bar( Bar const & ) = default;

This example also compiles file with -std=c++98 as well as with a recent g++
and -std=c++11.

This issue is pretty annoying when you replace Bar by, e.g., std::complex for
which we cannot explicitly add a copy ctor.

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/20130516/50a2fdfd/attachment.html>

More information about the llvm-bugs mailing list