https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96286
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to CVS Commits from comment #4) > c++: limit instantiation with ill-formed class [PR96286] This change and the one for PR92193 improve our limiting of recursive instantiation leading to unhelpful errors, but they don't help with the vector 89164 testcase you pointed me at, because the static_assert is buried deep in the call stack. wa.ii: In instantiation of ‘constexpr bool std::__check_constructible() [with _ValueType = X; _Tp = X&]’: wa.ii:20407:119: required from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = X*; _ForwardIterator = X*]’ wa.ii:20560:37: required from ‘constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = X*; _ForwardIterator = X*; _Tp = X]’ wa.ii:22118:33: required from ‘constexpr void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = X*; _Tp = X; _Alloc = std::allocator<X>]’ wa.ii:21612:23: required from here wa.ii:20342:56: error: static assertion failed: result type must be constructible from input type and then later we get wa.ii: In instantiation of ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = X; _Args = {X&}]’: wa.ii:20357:21: required from ‘constexpr _ForwardIterator std::__do_uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = X*; _ForwardIterator = X*]’ wa.ii:20558:30: required from ‘constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = X*; _ForwardIterator = X*; _Tp = X]’ wa.ii:22118:33: required from ‘constexpr void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = X*; _Tp = X; _Alloc = std::allocator<X>]’ wa.ii:21612:23: required from here wa.ii:13010:21: error: no matching function for call to ‘construct_at(X*&, X&)’ but _Construct was queued for instantiation before we hit the static_assert; it was prompted by an earlier line in __uninitialized_copy_a than the one that led to the instantiation of __check_constructible. I get better results if I add the static_assert to __uninitialized_copy_a, so we hit it before queuing any further instantiations.