[cfe-dev] std::is_trivial_default_constructible<T>, what's required?!

Gabriel Charette via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 25 04:11:07 PST 2018


Hello Clang/C++ experts!

I'm confused on what it takes to be std::is_trivial_default_constructible?

This doesn't even compile (leaving x_ uninitialized compiles but I don't
see why it's not trivial to initialize a POD member inline):

class Test {
 public:
  int x_ = 0;
};

static_assert(std::is_trivially_default_constructible<Test>::value, "");

-> error: static_assert failed due to requirement
'std::is_trivially_default_constructible<Test>::value' ""

I also tried making a constexpr Test() = default; constructor but I can't
get anything with POD members initialized inline to pass the
std::is_trivially_default_constructible test...?!

Thanks!
Gab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180125/2ef12608/attachment.html>


More information about the cfe-dev mailing list