https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106993
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 <string> #include <string_view> struct object{ operator std::string(){return "";} }; struct foo{ foo operator[](std::string_view s){ return foo{}; } template <typename T> operator T(){ return object{}; } }; int main(){ foo f; std::string s = f["a"]; } ```