[Bug c++/50093] New: [4.6 Regression] STL containers of non-default-constructible classes fail under -std=c++0x
andersk at mit dot edu
gcc-bugzilla@gcc.gnu.org
Mon Aug 15 20:07:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50093
Bug #: 50093
Summary: [4.6 Regression] STL containers of
non-default-constructible classes fail under
-std=c++0x
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: andersk@mit.edu
This code builds with ‘g++-4.5’, ‘g++-4.5 -std=c++0x’, and ‘g++-4.6’, but fails
with ‘g++-4.6 -std=c++0x’:
#include <vector>
class Foo {
Foo(int) {}
};
template class std::vector<Foo>;
int main() {return 0;}
$ g++-4.6 -std=c++0x foo.cc
In file included from /usr/include/c++/4.6/vector:63:0,
from foo.cc:1:
/usr/include/c++/4.6/bits/stl_construct.h: In function ‘void
std::_Construct(_T1*, _Args&& ...) [with _T1 = Foo, _Args = {}]’:
/usr/include/c++/4.6/bits/stl_uninitialized.h:481:3: instantiated from
‘static void
std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator,
_Size) [with _ForwardIterator = Foo*, _Size = long unsigned int, bool
_TrivialValueType = false]’
/usr/include/c++/4.6/bits/stl_uninitialized.h:529:7: instantiated from ‘void
std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator
= Foo*, _Size = long unsigned int]’
/usr/include/c++/4.6/bits/stl_uninitialized.h:589:7: instantiated from ‘void
std::__uninitialized_default_n_a(_ForwardIterator, _Size, std::allocator<_Tp>&)
[with _ForwardIterator = Foo*, _Size = long unsigned int, _Tp = Foo]’
/usr/include/c++/4.6/bits/stl_vector.h:1134:2: instantiated from ‘void
std::vector<_Tp, _Alloc>::_M_default_initialize(std::vector<_Tp,
_Alloc>::size_type) [with _Tp = Foo, _Alloc = std::allocator<Foo>,
std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
foo.cc:5:21: instantiated from here
/usr/include/c++/4.6/bits/stl_construct.h:76:7: error: no matching function for
call to ‘Foo::Foo()’
/usr/include/c++/4.6/bits/stl_construct.h:76:7: note: candidates are:
foo.cc:3:5: note: Foo::Foo(int)
foo.cc:3:5: note: candidate expects 1 argument, 0 provided
foo.cc:2:7: note: constexpr Foo::Foo(const Foo&)
foo.cc:2:7: note: candidate expects 1 argument, 0 provided
foo.cc:2:7: note: constexpr Foo::Foo(Foo&&)
foo.cc:2:7: note: candidate expects 1 argument, 0 provided
More information about the Gcc-bugs
mailing list