Why the compiler tries to call A(int) to construct instead of A(int, int) when calling std::vector::emplace_back(int, int) in C++17?
#include<vector> struct A{}; int main() { std::vector<A>a; a.emplace_back(0, 0); } Compiling this code with -std=c++17, the error below is shown: /usr/include/c++/13/bits/new_allocator.h:187:11: error: new initializer expression list treated as compound expression [-fpermissive] 187 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)…); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/new_allocator.h:187:11: error: no matching function for call to ‘A::A(int)’ a.cpp:2:8: note: candidate: ‘constexpr A::A()’ 2 […]