https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85576
Bug ID: 85576 Summary: A template union containing a friend function causes non-template type used as a template error Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: malcolm.parsons at gmail dot com Target Milestone: --- For this code: template <typename T> union Union { friend bool operator==(const Union& a, const Union& b) { return true; } T t; }; Union<int> i; GCC reports an error: <source>:9:10: error: non-template type 'Union' used as a template Union<int> i; ^ Clang and MSVC both accept this code: https://godbolt.org/g/S9p7hw