https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64147
Bug ID: 64147 Summary: vector resize() fails for non-copyable type Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ebf at users dot sourceforge.net Compiling the below program with -std=c++11 fails, "error: call to deleted constructor of 'Foo'". This seems incorrect since C++11 explicitly added a new single argument vector resize method that is supposed to default-construct elements rather than copy them. --- #include <vector> class Foo { public: Foo() {} Foo(const Foo&) = delete; }; int main() { std::vector<Foo> vec; vec.resize(42); // error: call to deleted constructor of 'Foo' } --- By contrast, the following program using the vector size constructor works ok: --- #include <vector> class Foo { public: Foo() {} Foo(const Foo&) = delete; }; int main() { std::vector<Foo> vec(42); // compiles fine }