Clang makes check for function redefinition after it merged the new
declaration with the existing one. As a result, it produces poor
diagnostics in the case of a friend function defined inline, as in
the code:
void func() {} class C { friend void func() {} };
Error message in this case states that `inline declaration of 'func'
follows non-inline definition`, which is misleading, as func does
not have explicit inline specifier.
With this changes compiler reports function redefinition if the new
function is a friend defined inline and it does not have explicit
inline specifier.
This is somewhat confusing to me: are you using the !New->isOutOfLine() || !New->getLexicalDeclContext()->isRecord() check to ensure that this new declaration is not a friend?