From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F26803839430; Thu, 15 Jul 2021 11:58:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F26803839430 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101460] Useless cascade of overload resolution errors for invalid expression Date: Thu, 15 Jul 2021 11:58:53 +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: 12.0 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 11:58:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101460 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-07-15 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- I suppose the problem here is that the failed constant evaluation of frob<-= 1>() only happens as a result of trying to use it as a template argument (where a constant expression is required) which doesn't happen until overload resolu= tion is performed. So we have to at least being doing OR before we get a problem. But maybe we can remember that it failed once, and so stop trying. If it's = not a valid constant expression, *that* is the error, not the fact that none of= the get overloads can be called with an invalid constant expression. Even if I change the code to do this it keeps trying overload resolution for get: template void get_n(tuple& t) { constexpr unsigned n =3D frob(); get(t); } The constexpr initialization of 'n' failed with a static_assert *and* a non-constant narrowing conversion, so why do we continue and even attempt overload resolution for 'get'?=