Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -12231,12 +12231,12 @@ // If adding the initializer will turn this declaration into a definition, // and we already have a definition for this variable, diagnose or otherwise // handle the situation. - VarDecl *Def; - if ((Def = VDecl->getDefinition()) && Def != VDecl && - (!VDecl->isStaticDataMember() || VDecl->isOutOfLine()) && - !VDecl->isThisDeclarationADemotedDefinition() && - checkVarDeclRedefinition(Def, VDecl)) - return; + if (VarDecl *Def = VDecl->getDefinition()) + if (Def != VDecl && + (!VDecl->isStaticDataMember() || VDecl->isOutOfLine()) && + !VDecl->isThisDeclarationADemotedDefinition() && + checkVarDeclRedefinition(Def, VDecl)) + return; if (getLangOpts().CPlusPlus) { // C++ [class.static.data]p4 @@ -12350,12 +12350,10 @@ // Variables declared within a function/method body (except for references) // are handled by a dataflow analysis. // This is undefined behavior in C++, but valid in C. - if (getLangOpts().CPlusPlus) { + if (getLangOpts().CPlusPlus) if (!VDecl->hasLocalStorage() || VDecl->getType()->isRecordType() || - VDecl->getType()->isReferenceType()) { + VDecl->getType()->isReferenceType()) CheckSelfReference(*this, RealDecl, Init, DirectInit); - } - } // If the type changed, it means we had an incomplete type that was // completed by the initializer. For example: