https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71982
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Trunk gives: [apinski@xeond2 src]$ ~/upstream-gcc/bin/gcc t.cc t.cc: In instantiation of ‘bool operator==(const A<T>&, const A<T>&) [with T = const B]’: t.cc:25:30: required from here t.cc:1:34: error: no match for ‘operator==’ (operand types are ‘const B’ and ‘const B’) 1 | #define MACRO(left, right) *left == *right | ^ t.cc:15:10: note: in expansion of macro ‘MACRO’ 15 | return MACRO(_left, _right); | ^~~~~ t.cc:10:6: note: candidate: ‘template<class T> bool operator==(const A<T>&, const A<T>&)’ 10 | bool operator==(const A<T>& left, const A<T>& right) | ^~~~~~~~ t.cc:10:6: note: template argument deduction/substitution failed: t.cc:1:34: note: ‘const B’ is not derived from ‘const A<T>’ 1 | #define MACRO(left, right) *left == *right | ^ t.cc:15:10: note: in expansion of macro ‘MACRO’ 15 | return MACRO(_left, _right); | ^~~~~ t.cc:24:6: note: candidate: ‘bool operator==(C&, C&)’ 24 | bool operator==(C& left, C& right) { | ^~~~~~~~ t.cc:24:20: note: no known conversion for argument 1 from ‘const B’ to ‘C&’ 24 | bool operator==(C& left, C& right) { | ~~~^~~~ Which looks fine. While GCC 10.1.0 gives: t.cc: In instantiation of 'bool operator==(const A<T>&, const A<T>&) [with T = const B]': t.cc:25:30: required from here t.cc:1:34: error: no match for 'operator==' (operand types are 'const B' and 'const B') 1 | #define MACRO(left, right) *left == *right | ~~~~~~^~~~~~~~~ 2 | | 3 | template <typename T> | ~~~~~~~~~~~~~~~~~~~~~ 4 | struct A { .... This is on the same machine. This happens on both aarch64 and x86_64. The problem is not the code is being rejected (correctly) but the warning location includes so much more than it should in previous versions of GCC.