File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -10057,15 +10057,18 @@ void ASTReader::finishPendingActions() {
10057
10057
// For a function defined inline within a class template, force the
10058
10058
// canonical definition to be the one inside the canonical definition of
10059
10059
// the template. This ensures that we instantiate from a correct view
10060
- // of the template.
10060
+ // of the template. This behaviour seems to be important only for inline
10061
+ // friend functions. For normal member functions, it might results in
10062
+ // selecting canonical decl from module A but body from module B.
10061
10063
//
10062
10064
// Sadly we can't do this more generally: we can't be sure that all
10063
10065
// copies of an arbitrary class definition will have the same members
10064
10066
// defined (eg, some member functions may not be instantiated, and some
10065
10067
// special members may or may not have been implicitly defined).
10066
- if (auto *RD = dyn_cast<CXXRecordDecl>(FD->getLexicalParent ()))
10067
- if (RD->isDependentContext () && !RD->isThisDeclarationADefinition ())
10068
- continue ;
10068
+ if (FD->getFriendObjectKind ())
10069
+ if (auto *RD = dyn_cast<CXXRecordDecl>(FD->getLexicalParent ()))
10070
+ if (RD->isDependentContext () && !RD->isThisDeclarationADefinition ())
10071
+ continue ;
10069
10072
10070
10073
// FIXME: Check for =delete/=default?
10071
10074
const FunctionDecl *Defn = nullptr ;
You can’t perform that action at this time.
0 commit comments