From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EF9C83858400; Tue, 31 Aug 2021 21:48:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF9C83858400 From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96286] Unhelpful errors after a failed static_assert Date: Tue, 31 Aug 2021 21:48:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2021 21:48:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96286 Jason Merrill changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #5 from Jason Merrill --- (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 vec= tor 89164 testcase you pointed me at, because the static_assert is buried deep = in the call stack. wa.ii: In instantiation of =E2=80=98constexpr bool std::__check_constructib= le() [with _ValueType =3D X; _Tp =3D X&]=E2=80=99: wa.ii:20407:119: required from =E2=80=98_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [= with _InputIterator =3D X*; _ForwardIterator =3D X*]=E2=80=99 wa.ii:20560:37: required from =E2=80=98constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterato= r, std::allocator<_Tp>&) [with _InputIterator =3D X*; _ForwardIterator =3D X*;= _Tp =3D X]=E2=80=99 wa.ii:22118:33: required from =E2=80=98constexpr void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator =3D X*; _Tp =3D X; _Alloc= =3D std::allocator]=E2=80=99 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 =E2=80=98constexpr void std::_Construct(_Tp*, _A= rgs&& ...) [with _Tp =3D X; _Args =3D {X&}]=E2=80=99: wa.ii:20357:21: required from =E2=80=98constexpr _ForwardIterator std::__do_uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [wi= th _InputIterator =3D X*; _ForwardIterator =3D X*]=E2=80=99 wa.ii:20558:30: required from =E2=80=98constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterato= r, std::allocator<_Tp>&) [with _InputIterator =3D X*; _ForwardIterator =3D X*;= _Tp =3D X]=E2=80=99 wa.ii:22118:33: required from =E2=80=98constexpr void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator =3D X*; _Tp =3D X; _Alloc= =3D std::allocator]=E2=80=99 wa.ii:21612:23: required from here wa.ii:13010:21: error: no matching function for call to =E2=80=98construct_= at(X*&, X&)=E2=80=99 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.=