public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi 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: Thu, 15 Jul 2021 10:44:30 +0000 [thread overview] Message-ID: <bug-96286-4-h6BNeZw3tV@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 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-07-15 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is a major pain the backside for trying to give good diagnostics for std::get<T>(tuple<Types...>&). I want to stop with a "clear" static assertion like: In file included from /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/tuple/element_access/101427.cc:3: /home/jwakely/gcc/12/include/c++/12.0.0/tuple: In instantiation of 'constexpr std::size_t std::__find_uniq_type_in_pack() [with _Tp = long int; _Types = {float, int, int}; std::size_t = long unsigned int]': /home/jwakely/gcc/12/include/c++/12.0.0/tuple:1452:63: required from 'constexpr _Tp& std::get(std::tuple<_UTypes ...>&) [with _Tp = long int; _Types = {float, int, int}]' /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/tuple/element_access/101427.cc:7:22: required from here /home/jwakely/gcc/12/include/c++/12.0.0/tuple:1441:27: error: static assertion failed: the type T in std::get<T> must occur exactly once in the tuple 1441 | static_assert(__idx >= 0, | ~~~~~~^~~~ But G++ insists on continuing past that point, returning an out-of-range index which causes 200 lines of errors because std::get<SIZE_MAX>(t) is invalid. I know it's invalid, that's why I made the static assertion fail. Just stop. I now have to jump through ridiculous hoops to add additional code to munge the invalid value into some other value to stop the 200 lines of noise.
next prev parent reply other threads:[~2021-07-15 10:44 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 ` redi at gcc dot gnu.org [this message] 2021-07-15 10:56 ` [Bug c++/96286] " 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 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-h6BNeZw3tV@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: linkBe 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).