https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89510
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-04-30 Summary|new_allocator::construct |[9/10 Regression] |needs to be constrained |new_allocator::construct | |needs to be constrained Known to work| |8.4.1 Keywords| |rejects-valid Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Known to fail| |10.0, 9.3.1 Status|UNCONFIRMED |ASSIGNED Target Milestone|--- |9.4 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is actually a regression that breaks valid code: #include <memory> template<typename...> using void_t = void; template<typename T, typename U, typename = void> struct has_construct : std::false_type { }; template<typename T, typename U> struct has_construct<T, U, void_t<decltype(std::declval<T&>().construct(std::declval<U*>()))>> : std::true_type { }; struct X { X(int); }; constexpr bool b = has_construct<std::allocator<X>, X>::value; In file included from /home/jwakely/gcc/9/include/c++/9.2.1/x86_64-pc-linux-gnu/bits/c++allocator.h:33, from /home/jwakely/gcc/9/include/c++/9.2.1/bits/allocator.h:46, from /home/jwakely/gcc/9/include/c++/9.2.1/memory:63, from alloc.cc:1: /home/jwakely/gcc/9/include/c++/9.2.1/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = X; _Args = {}; _Tp = X]': alloc.cc:17:55: recursively required by substitution of 'template<class T, class U> struct has_construct<T, U, void_t<decltype (declval<T&>().construct(declval<U*>()))> > [with T = std::allocator<X>; U = X]' alloc.cc:17:55: required from here /home/jwakely/gcc/9/include/c++/9.2.1/ext/new_allocator.h:145:20: error: no matching function for call to 'X::X()' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alloc.cc:15:12: note: candidate: 'X::X(int)' 15 | struct X { X(int); }; | ^ alloc.cc:15:12: note: candidate expects 1 argument, 0 provided alloc.cc:15:8: note: candidate: 'constexpr X::X(const X&)' 15 | struct X { X(int); }; | ^ alloc.cc:15:8: note: candidate expects 1 argument, 0 provided alloc.cc:15:8: note: candidate: 'constexpr X::X(X&&)' alloc.cc:15:8: note: candidate expects 1 argument, 0 provided