Index: clang/lib/AST/MicrosoftMangle.cpp =================================================================== --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -948,11 +948,13 @@ mangleSourceName(Name); // If the context of a closure type is an initializer for a class - // member (static or nonstatic), it is encoded in a qualified name. + // member (static or nonstatic) or is a top level decl, it is encoded + // in a qualified name. if (LambdaManglingNumber && LambdaContextDecl) { if ((isa(LambdaContextDecl) || isa(LambdaContextDecl)) && - LambdaContextDecl->getDeclContext()->isRecord()) { + (LambdaContextDecl->getDeclContext()->isRecord() || + LambdaContextDecl->getDeclContext()->isTranslationUnit())) { mangleUnqualifiedName(cast(LambdaContextDecl)); } }