public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-96286-4-JPCfPO6DZ1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96286-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2021-08-31 21:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 15:00 [Bug c++/96286] New: " redi at gcc dot gnu.org
2021-07-15 10:44 ` [Bug c++/96286] " redi at gcc dot gnu.org
2021-07-15 10:56 ` redi at gcc dot gnu.org
2021-07-15 11:21 ` redi at gcc dot gnu.org
2021-08-30 21:27 ` cvs-commit at gcc dot gnu.org
2021-08-31 21:48 ` jason at gcc dot gnu.org [this message]
2021-09-02 12:27 ` jason at gcc dot gnu.org
2021-09-02 12:27 ` jason at gcc dot gnu.org
2021-09-02 12:56 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96286-4-JPCfPO6DZ1@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).