https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95310
Bug ID: 95310 Summary: [concepts] Unrelated template parameters printed in diagnostic Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ensadc at mailnesia dot com CC: asutton at gcc dot gnu.org Target Milestone: --- https://godbolt.org/z/M8CVwc ==== template <class T> using iter_reference_t = decltype(*T{}); template <typename F> struct result { using type = iter_reference_t<F>; }; template <class Out, class T> concept indirectly_writable = requires(Out&& o, T&& t) { iter_reference_t<Out>(*o) = 0; }; static_assert(indirectly_writable<const int*, int&>); ==== <source>:13:15: error: static assertion failed 13 | static_assert(indirectly_writable<const int*, int&>); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:13:15: note: constraints not satisfied <source>:10:9: required by the constraints of 'template<class Out, class T> concept indirectly_writable' <source>:10:31: in requirements with 'Out&& o', 'T&& t' [with F = const int*; T = int&; Out = const int*] <source>:11:29: note: the required expression 'decltype(*{})(*o)=0' is invalid 11 | iter_reference_t<Out>(*o) = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail ==== Note "[with F = const int*; T = int&; Out = const int*]". The 'F = const int*;' part is spurious. When the template parameter of `result` has the same name as the parameter of the concept (which is the case I originally encountered), the output can be quite confusing. The expression 'decltype(*{})(*o)=0' also seems wrong. Might be related to bug 94862.