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

             Bug #: 14123
           Summary: union member with a user-declared, but not
                    user-provided, trivial constructor implicitly deletes
                    unions default constructor
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


The following valid code is rejected

// clang++ -std=c++11 test.cpp
union U {
struct S {
    S() = default;
} s;
} u;

error: call to implicitly-deleted default constructor of 'union U'
} u;
  ^
note: default constructor of 'U' is implicitly deleted because variant field
's' has a non-trivial default constructor
} s;
  ^

Clang incorrectly determines that the user declared (but not user provided)
constructor is non-trivial.

Interestingly, the following similar code is not rejected:

struct S {
    S() = default;
};

union U {
    S s;
} u;

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to