зеркало из https://github.com/microsoft/clang.git
Defined friend functions are *implicitly* inlined, unless the inline specifier occurs explicitly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
7f0a915eb5
Коммит
b0a2fcc1e9
|
@ -3669,14 +3669,6 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
|||
AbstractReturnType))
|
||||
D.setInvalidType();
|
||||
|
||||
|
||||
if (isFriend) {
|
||||
// C++ [class.friend]p5
|
||||
// A function can be defined in a friend declaration of a
|
||||
// class . . . . Such a function is implicitly inline.
|
||||
isInline |= IsFunctionDefinition;
|
||||
}
|
||||
|
||||
if (Name.getNameKind() == DeclarationName::CXXConstructorName) {
|
||||
// This is a C++ constructor declaration.
|
||||
assert(DC->isRecord() &&
|
||||
|
@ -3774,6 +3766,14 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
|||
NameInfo, R, TInfo, SC, SCAsWritten, isInline,
|
||||
true/*HasPrototype*/);
|
||||
}
|
||||
|
||||
if (isFriend && !isInline && IsFunctionDefinition) {
|
||||
// C++ [class.friend]p5
|
||||
// A function can be defined in a friend declaration of a
|
||||
// class . . . . Such a function is implicitly inline.
|
||||
NewFD->setImplicitlyInline();
|
||||
}
|
||||
|
||||
SetNestedNameSpecifier(NewFD, D);
|
||||
isExplicitSpecialization = false;
|
||||
isFunctionTemplateSpecialization = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче