diff options
-rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 4 | ||||
-rw-r--r-- | clang/test/Parser/cxx-friend.cpp | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 8d82d03d830..6bab7988cf0 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -176,7 +176,9 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, // If you remove this, you can remove the code that clears the flag // after parsing the member. if (D.getDeclSpec().isFriendSpecified()) { - getFunctionDecl(FnD)->setLateTemplateParsed(true); + FunctionDecl *FD = getFunctionDecl(FnD); + Actions.CheckForFunctionRedefinition(FD); + FD->setLateTemplateParsed(true); } } else { // If semantic analysis could not build a function declaration, diff --git a/clang/test/Parser/cxx-friend.cpp b/clang/test/Parser/cxx-friend.cpp index a13e7babc53..a3b89cc688b 100644 --- a/clang/test/Parser/cxx-friend.cpp +++ b/clang/test/Parser/cxx-friend.cpp @@ -30,6 +30,10 @@ class B { void f(A *a) { a->f(); } }; +void bar() {} // expected-note {{previous definition is here}} +class E { + friend void bar() {} // expected-error {{redefinition of 'bar'}} +}; |