This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

std::__debug::vector default ctor must not be defaulted


I think

#if __cplusplus < 201103L
      vector() _GLIBCXX_NOEXCEPT
      : _Base() { }
#else
      vector() = default;
#endif

(libstdc++-v3/include/debug/vector) introduced with r210123 (present in GCC 5 and trunk) is wrong. The standard mandates that the std::vector default ctor is user-provided ([vector.overview] "vector() noexcept : vector(Allocator()) { }"), and defaulting it breaks code like

  const std::vector< double > aDXArray;

because of [dcl.init] "If a program calls for the default initialization of an object of a const-qualified type T, T shall be a class type with a user-provided default constructor." (as flagged at least by trunk Clang).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]