From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BA7B3943401; Mon, 3 May 2021 14:01:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BA7B3943401 From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept Date: Mon, 03 May 2021 14:01:24 +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: 11.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Mon, 03 May 2021 14:01:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100288 --- Comment #5 from Patrick Palka --- (In reply to Frank B. Brokken from comment #4) > Dear ppalka at gcc dot gnu.org, you wrote: > >=20 > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100288 > >=20 > > Patrick Palka changed: > >=20 > > What |Removed |Added > > -----------------------------------------------------------------------= ----- > > Keywords| |ice-on-invalid-code > > See Also| |https://gcc.gnu.org/bu= gzill > > | |a/show_bug.cgi?id=3D99= 599 > >=20 > > --- Comment #3 from Patrick Palka --- > > Agreed, the testcase looks invalid much like PR99599. One workaround f= or > > avoiding the constraint recursion here would be to change the signature= of > >=20 > > template > > inline void operator<<(CSVTabIns &&tab, Type const &value) > >=20 > > to something like > >=20 > > template > U, OstreamInse= rtable > > Type> > > inline void operator<<(U &&tab, Type const &value) > >=20 > > so that the constraint OstreamInsertable is checked on this overl= oad only > > if the first argument to << has the expected type. > >=20 > > --=20 > > You are receiving this mail because: > > You reported the bug. >=20 > Hi Patrick, >=20 > Thanks for your e-mail. >=20 > Since (AFAICS) you directly and only sent your e-mail to me I'm wondering > whether you want me to comment on your e-mail. It's getting kind of late > here, > but I could send a more extensive reply tomorrow. Let me know if that's w= hat > you want. Oh sorry, that was just an automated email for the comment I posted to the bugzilla PR, which gets sent to everyone on the CC list of the PR. I wasn't expecting any sort of reply :) >=20 > I tried your suggestion, and it seems to solve the issue. But at the same > time > it puzzles me why=20 >=20 > template > inline void operator<<(CSVTabIns &&tab, Type const &value) > {} >=20 > won't be instantiated for FMT in >=20 > inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline) > { > tab << (*hline)(1); // insert hline in the next column > } >=20 > when FMT defines FMTHline as 'typedef FMT (*FMTHline)(unsigned)' and=20 >=20 > std::ostream &operator<<(std::ostream &out, FMT const &fmt) >=20 > is declared. I would have expected that=20 >=20 > tab << (*hline)(1); // insert hline in the next column >=20 > would cause the compiler to instantiate=20 >=20 > template > inline void operator<<(CSVTabIns &&tab, Type const &value) > {} >=20 > for Type =3D FMT. >=20 The compiler does try to instantiate that overload for Type =3D FMT there, = but when checking the constraint OstreamInsertable on this overload it nee= ds to resolve the << in requires(std::ostream &out, Type value) { out << value; }; for Type =3D FMT, during which it considers that same operator<< overload. = And CWG2369 says we now first check constraints before non-dependent conversion= s, but we're in the middle of checking the constraints on this overload, so we enter a constraint loop. > Maybe I'm missing something here? And it's also not something that caused= the > compiler's internal error. Yeah, we shouldn't be seeing an internal error even on an invalid testcase.= =20 This needs to be fixed.=