Index: clang/lib/AST/ItaniumMangle.cpp =================================================================== --- clang/lib/AST/ItaniumMangle.cpp +++ clang/lib/AST/ItaniumMangle.cpp @@ -2329,7 +2329,8 @@ Context.mangleObjCMethodName(MD, Out); } -static bool isTypeSubstitutable(Qualifiers Quals, const Type *Ty) { +static bool isTypeSubstitutable(Qualifiers Quals, const Type *Ty, + ASTContext &Ctx) { if (Quals) return true; if (Ty->isSpecificBuiltinType(BuiltinType::ObjCSel)) @@ -2338,7 +2339,11 @@ return true; if (Ty->isBuiltinType()) return false; - + // Through to Clang 6.0, we accidentally treated undeduced auto types as + // substitution candidates. + if (Ctx.getLangOpts().getClangABICompat() > LangOptions::ClangABI::Ver6 && + isa(Ty)) + return false; return true; } @@ -2399,7 +2404,8 @@ Qualifiers quals = split.Quals; const Type *ty = split.Ty; - bool isSubstitutable = isTypeSubstitutable(quals, ty); + bool isSubstitutable = + isTypeSubstitutable(quals, ty, Context.getASTContext()); if (isSubstitutable && mangleSubstitution(T)) return; @@ -3250,14 +3256,13 @@ } void CXXNameMangler::mangleType(const AutoType *T) { - QualType D = T->getDeducedType(); - // ::= Da # dependent auto - if (D.isNull()) { - assert(T->getKeyword() != AutoTypeKeyword::GNUAutoType && - "shouldn't need to mangle __auto_type!"); - Out << (T->isDecltypeAuto() ? "Dc" : "Da"); - } else - mangleType(D); + assert(T->getDeducedType().isNull() && + "Deduced AutoType shouldn't be handled here!"); + assert(T->getKeyword() != AutoTypeKeyword::GNUAutoType && + "shouldn't need to mangle __auto_type!"); + // ::= Da # auto + // ::= Dc # decltype(auto) + Out << (T->isDecltypeAuto() ? "Dc" : "Da"); } void CXXNameMangler::mangleType(const DeducedTemplateSpecializationType *T) { Index: clang/test/CodeGenCXX/lambda-expressions-inside-auto-functions.cpp =================================================================== --- clang/test/CodeGenCXX/lambda-expressions-inside-auto-functions.cpp +++ clang/test/CodeGenCXX/lambda-expressions-inside-auto-functions.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fblocks -emit-llvm -o - %s -fexceptions -std=c++1y | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fblocks -emit-llvm -o - %s -fexceptions -std=c++1y | FileCheck --check-prefix CHECK_ABI_LATEST %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fblocks -emit-llvm -o - %s -fexceptions -std=c++1y -fclang-abi-compat=6.0 | FileCheck --check-prefix CHECK_ABIV6 %s // CHECK-LABEL: define void @_ZN19non_inline_function3fooEv // CHECK-LABEL: define internal void @"_ZZN19non_inline_function3fooEvENK3$_0clEi"(%class.anon @@ -52,10 +53,12 @@ template auto foo() { return [](const T&) { return 42; }; } }; -//CHECK-LABEL: define linkonce_odr i32 @_ZZN22inline_member_function1AIdE14default_lambdaIdEEDavENKUlRKdE_clES5_(%class.anon +//CHECK_ABIV6: define linkonce_odr i32 @_ZZN22inline_member_function1AIdE14default_lambdaIdEEDavENKUlRKdE_clES5_(%class.anon +//CHECK_ABI_LATEST: define linkonce_odr i32 @_ZZN22inline_member_function1AIdE14default_lambdaIdEEDavENKUlRKdE_clES4_(%class.anon int run2 = A{}.func()(3.14); -//CHECK-LABEL: define linkonce_odr i32 @_ZZN22inline_member_function1AIcE14default_lambdaIcEEDavENKUlRKcE_clES5_(%class.anon +//CHECK_ABIV6: define linkonce_odr i32 @_ZZN22inline_member_function1AIcE14default_lambdaIcEEDavENKUlRKcE_clES5_(%class.anon +//CHECK_ABI_LATEST: define linkonce_odr i32 @_ZZN22inline_member_function1AIcE14default_lambdaIcEEDavENKUlRKcE_clES4_(%class.anon int run3 = A{}.func()('a'); } // end inline_member_function