[llvm-bugs] [Bug 25691] New: union conatining non-trivially-copyable member is trivially-copyable itself

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 1 03:59:40 PST 2015


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

            Bug ID: 25691
           Summary: union conatining non-trivially-copyable member is
                    trivially-copyable itself
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tomilovanatoliy at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Struct S recognized by type trait  as non-trivially-non-const-copy-assignable,
but union 

struct S
{
    constexpr S() = default;
    constexpr S(S const &) = default;
    constexpr S(S &) = default;
    constexpr S(S &&) = default;
    S & operator = (S const &) = default;
    S & operator = (S &) = default;
    S & operator = (S &&) = default;
};

static_assert(!std::is_trivially_assignable< S &, S & >{}, "!");

union U { S s; };

static_assert(std::is_trivially_assignable< U &, U & >{}, "!");

I use libc++ from trunk and std::is_trivially_assignable uses
`__is_trivially_assignable()` built-in type trait in turn.

-- 
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/20151201/73425cb5/attachment.html>


More information about the llvm-bugs mailing list