Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -1678,9 +1678,14 @@ SmallVector Elts; // First element is always return type. For 'void' functions it is NULL. QualType temp = Func->getReturnType(); - if (temp->getTypeClass() == Type::Auto && decl) - Elts.push_back(CreateType(cast(temp))); - else + if (temp->getTypeClass() == Type::Auto && decl) { + const AutoType *AT = cast(temp); + + if (AT->isDeduced() && ThisPtr->getPointeeCXXRecordDecl()->isLambda()) + Elts.push_back(getOrCreateType(AT->getDeducedType(), Unit)); + else + Elts.push_back(CreateType(AT)); + } else Elts.push_back(Args[0]); // "this" pointer is always first argument. Index: clang/test/CodeGenCXX/no_auto_return_lambda.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenCXX/no_auto_return_lambda.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s + +__attribute__((used)) int g() { + auto f = []() { return 10; }; + return f(); +} + +// CHECK: !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +// CHECK-NOT: !DIBasicType(tag: DW_TAG_unspecified_type, name: "auto")