From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B97F6397B804; Thu, 15 Jul 2021 10:44:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B97F6397B804 From: "redi at gcc dot 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 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: redi 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: bug_status cf_reconfirmed_on everconfirmed 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: Thu, 15 Jul 2021 10:44:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96286 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-07-15 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- This is a major pain the backside for trying to give good diagnostics for std::get(tuple&). I want to stop with a "clear" static asserti= on like: In file included from /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/tuple/element_acce= ss/101427.cc:3: /home/jwakely/gcc/12/include/c++/12.0.0/tuple: In instantiation of 'constex= pr std::size_t std::__find_uniq_type_in_pack() [with _Tp =3D long int; _Types = =3D {float, int, int}; std::size_t =3D 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 =3D long int; = _Types =3D {float, int, int}]' /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/tuple/element_acce= ss/101427.cc:7:22: required from here /home/jwakely/gcc/12/include/c++/12.0.0/tuple:1441:27: error: static assert= ion failed: the type T in std::get must occur exactly once in the tuple 1441 | static_assert(__idx >=3D 0, | ~~~~~~^~~~ But G++ insists on continuing past that point, returning an out-of-range in= dex which causes 200 lines of errors because std::get(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.=