From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 10E14385840F; Thu, 11 Nov 2021 23:02:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10E14385840F From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/89997] Garbled expression in error message with -fconcepts Date: Thu, 11 Nov 2021 23:02:56 +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: 9.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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, 11 Nov 2021 23:02:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89997 --- Comment #1 from Andrew Pinski --- In GCC 10+ (with -fconcepts-diagnostics-depth=3D2), GCC produces: : In function 'void test()': :17:16: error: use of function 'void check() requires requires(X x,= T val) {x.X::operator<<()("hello") << val;} [with T =3D int]' with unsatisfied constraints 17 | check(); // mangled error | ^ :13:6: note: declared here 13 | void check() requires requires (X x, T val) { x << "hello" << val; = } {} | ^~~~~ :13:6: note: constraints not satisfied : In instantiation of 'void check() requires requires(X x, T val) {x.X::operator<<()("hello") << val;} [with T =3D int]': :17:16: required from here :13:6: required by the constraints of 'template void che= ck() requires requires(X x, T val) {x.X::operator<<()("hello") << val;}' :13:23: in requirements with 'X x', 'T val' [with T =3D int] :13:60: note: the required expression '("hello"->x.X::operator<<() = << val)' is invalid, because 13 | void check() requires requires (X x, T val) { x << "hello" << val; = } {} | ~~~~~~~~~~~~~^~~~~~ :13:63: error: invalid conversion from 'int' to 'void*' [-fpermissi= ve] 13 | void check() requires requires (X x, T val) { x << "hello" << val; = } {} | ^~~ | | | int :9:19: note: initializing argument 1 of 'X Y::operator<<(void*)' 9 | X operator<< (void*); | ^~~~~ Is this good enoug now? Note clang produces: :17:5: error: no matching function for call to 'check' check(); // mangled error ^~~~~~~~~~ :13:6: note: candidate template ignored: constraints not satisfied [with T =3D int] void check() requires requires (X x, T val) { x << "hello" << val; } {} ^ :13:60: note: because 'x << "hello" << val' would be invalid: inval= id operands to binary expression ('Y' and 'int') void check() requires requires (X x, T val) { x << "hello" << val; } {} ^=