MCVE's speak louder than words:
// int bar();
template <bool B> class Foo {
friend int ::bar() { return 123; }
};
int main()
{
Foo<false> f1;
Foo<true> f2;
}
with GCC 6 and --std=c++14, this gives me:
a.cpp: In instantiation of ‘class Foo<true>’:
a.cpp:9:12: required from here
a.cpp:3:13: error: redefinition of ‘int bar()’
friend int ::bar() { return 123; }
^~
a.cpp:3:13: note: ‘int bar()’ previously defined here
Now, I'm not sure what the standard says; but I know that the compiler knows that the friend is not templated on B, nor does its definition use B. So why can't it apply the "oh, all inline copies of the same definition of a function are the same" rule?