[LLVMbugs] [Bug 8342] New: Direct-initialization of class object by its own class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 8 15:55:26 PDT 2010


           Summary: Direct-initialization of class object by its own class
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub-johannes at web.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Clang does not like the following code

struct A {
  A(int) { }
  explicit A(A const&) { }

int main() { 
  A a = 1;

The copy of the created A temporary to "a" is direct-initialization and so
needs to consider the explicit copy constructor. But clang says

  main1.cpp:7:5: error: no viable constructor copying variable of type 'A'

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