Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -1906,7 +1906,8 @@ // entirely, but we're not there yet. DeclContext *SavedContext = CurContext; CurContext = Parent; - PushOnScopeChains(New, TUScope); + if (TUScope) + PushOnScopeChains(New, TUScope); CurContext = SavedContext; return New; }