Do concepts change the definition of POD/Trivial types?

38 views
Skip to first unread message

xcvr

unread,
Jan 28, 2016, 12:02:56 AM1/28/16
to ISO C++ Standard - Discussion
Hello!

I did not see a mention of C compatibility or POD/Triviality in the concepts proposal. I was wondering what, if any, changes concepts results causes in the definition of POD/triviality.

Consider the following code (http://melpon.org/wandbox/permlink/G2YbVKEvQZ7SqK91), which currently compiles on gcc regardless of what sizeof(std::size_t) evaluates to:
#include <iostream>

struct A
{
    A
() = default;
    A
(const A&) = default;
    A
(A&&) = default;
    A
& operator=(const A&) = default;
    A
& operator=(A&&) = default;
   
~A() requires (sizeof(std::size_t) == 5) = default;
};


int main()
{
   
static_assert(std::is_trivial<A>::value, "");
   
static_assert(std::is_pod<A>::value, "");
// does not compile
//    A a;
//    A b(a);
   
return 0;
}

See section 12.4.5.4 through 12.4.5.6 of the current working draft for the definition of trivial destructors. Copy/move constructors/assignment operators may also be affected.

Keeping it brief,
 - xcvr
Reply all
Reply to author
Forward
0 new messages