From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 22AD53858D37; Wed, 21 Sep 2022 07:43:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22AD53858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663746232; bh=Um21jDyH0CMKmb5O/RdrxcEcBBjhF0F685tCBN+xEX0=; h=From:To:Subject:Date:From; b=sY0Tu9vJ2gfjkyJeAt7MrjIq1KsOyIWkO56R+GGQOhnq9i4nmuOPt4hbqUjnfFqwH rGeRpvMT4ScFDxVOogEV8tVtmJeKjd42a4fTKRndqVfwpUzET2fQeuy5wX75R8pZ81 5CH8ZRt5k14SrAkuMtmVjwYr9oUtZmrJOzOORpmg= From: "jlame646 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106993] New: GCC accepts invalid program involving templated conversion function Date: Wed, 21 Sep 2022 07:43:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlame646 at gmail dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106993 Bug ID: 106993 Summary: GCC accepts invalid program involving templated conversion function Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- The following invalid(afaik) program is accepted by gcc and msvc. Demo link: https://godbolt.org/z/E5crEqqfx ``` #include #include struct object{ operator std::string(){return "";} }; struct foo{ foo operator[](std::string_view s){ return foo{}; } template operator T(){ return object{}; } }; int main(){ foo f; std::string s =3D f["a"];=20 } ```=