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

Stephan Bergmann sbergman@redhat.com
Tue Apr 28 15:42:00 GMT 2015


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).



More information about the Libstdc++ mailing list