https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108490
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #2) > Yes. The attribute has to be there, so it's a Circle bug if it doesn't > support that grammar. Why can't it be before the friend specifier? template<typename _It2, sentinel_for<_It> _Sent2> requires sentinel_for<_Sent, _It2> [[nodiscard]] friend constexpr bool operator== (const common_iterator& __x, const common_iterator<_It2, _Sent2>& __y) { ... } I mean, at least struct S { template <typename T> friend constexpr bool foo [[nodiscard]] (const S &, const T &) { return true; } template <typename T> [[nodiscard]] friend constexpr bool bar (const S &, const T &) { return true; } }; void foo () { S s; foo (s, 0); bar (s, 0); } warns in both cases with various versions of g++ as well as clang++ (tried clang++ 4 and trunk and some random in between). ICC (even 19) doesn't warn in either case.