return false;
}
+ // FIXME: If D is a local extern declaration, this check doesn't make sense;
+ // we should be checking its lexical context instead in that case, because
+ // that is its scope.
DeclContext *DCtx = D->getDeclContext()->getRedeclContext();
return AllowInlineNamespace ? Ctx->InEnclosingNamespaceSetOf(DCtx)
: Ctx->Equals(DCtx);
bool OldParamHasDfl = OldParam->hasDefaultArg();
bool NewParamHasDfl = NewParam->hasDefaultArg();
- NamedDecl *ND = Old;
-
// The declaration context corresponding to the scope is the semantic
// parent, unless this is a local function declaration, in which case
// it is that surrounding function.
- DeclContext *ScopeDC = New->getLexicalDeclContext();
- if (!ScopeDC->isFunctionOrMethod())
- ScopeDC = New->getDeclContext();
- if (S && !isDeclInScope(ND, ScopeDC, S) &&
+ DeclContext *ScopeDC = New->isLocalExternDecl()
+ ? New->getLexicalDeclContext()
+ : New->getDeclContext();
+ if (S && !isDeclInScope(Old, ScopeDC, S) &&
!New->getDeclContext()->isRecord())
// Ignore default parameters of old decl if they are not in
// the same scope and this is not an out-of-line definition of
// a member function.
OldParamHasDfl = false;
+ if (New->isLocalExternDecl() != Old->isLocalExternDecl())
+ // If only one of these is a local function declaration, then they are
+ // declared in different scopes, even though isDeclInScope may think
+ // they're in the same scope. (If both are local, the scope check is
+ // sufficent, and if neither is local, then they are in the same scope.)
+ OldParamHasDfl = false;
if (OldParamHasDfl && NewParamHasDfl) {
int pr20055_f(int x = 0, int y = UNDEFINED); // expected-error{{use of undeclared identifier}}
int pr20055_v = pr20055_f(0);
+
+void PR20769() { void PR20769(int = 1); }
+void PR20769(int = 2);
+
+void PR20769_b(int = 1);
+void PR20769_b() { void PR20769_b(int = 2); }