The following:

#include <type_traits>

struct b
{
  b() = default;
  b(const b&) = delete;
};

void test01()
{
  typedef b     test_type;

  // typedef std::is_standard_layout<test_type> standard_layout_p;
  typedef std::has_trivial_default_constructor<test_type> ctor_p;
  typedef std::has_trivial_destructor<test_type> dtor_p;

  // static_assert(standard_layout_p::value, "not standard_layout");
  static_assert(ctor_p::value, "default ctor not trivial");
  static_assert(dtor_p::value, "dtor not trivial");
}

Gives:

%$bld/H-x86-gcc.20081020/bin/g++ -std=gnu++0x -c standard_layout.cc
standard_layout.cc: In function 'void test01()':
standard_layout.cc:40: error: static assertion failed: "default ctor not
trivial"

Removing the copy constructor makes the error go away.


-- 
           Summary: has_trivial_default_constructor vs. deleted copy ctor
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
  GCC host triplet: all


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37906

Reply via email to