[PATCH] D26065: Improve diagnostics if friend function redefines file-level function.

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 21:32:14 PDT 2017


sepavloff added inline comments.


================
Comment at: lib/Sema/SemaDeclCXX.cpp:646
+             // in this case, redefinition will be diagnosed later.
+             (New->isInlineSpecified() || !New->isOutOfLine() ||
+              !New->getLexicalDeclContext()->isRecord())) {
----------------
arphaman wrote:
> 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`?
Indeed, this check is obscure. Replaced by call to `getFriendObjectKind`.


https://reviews.llvm.org/D26065





More information about the cfe-commits mailing list