diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-12-19 22:10:51 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-12-19 22:10:51 +0000 |
commit | 5a0e50cd87840b9f326e88d3b35c04c3c3b4c76b (patch) | |
tree | 6fc3634d210ee2245b5f77302dea00b2402bc870 /clang/lib/Sema/SemaStmt.cpp | |
parent | 86a7f7154987ccb1a09fd399162694e120a427a7 (diff) | |
download | bcm5719-llvm-5a0e50cd87840b9f326e88d3b35c04c3c3b4c76b.tar.gz bcm5719-llvm-5a0e50cd87840b9f326e88d3b35c04c3c3b4c76b.zip |
DR1048: drop top-level cv-qualifiers when deducing the return type of a
lambda-expression in C++11, to match the C++14 rules.
llvm-svn: 224620
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index a3fd6fa9a17..f4877520706 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -2652,8 +2652,12 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { return StmtError(); RetValExp = Result.get(); + // DR1048: even prior to C++14, we should use the 'auto' deduction rules + // when deducing a return type for a lambda-expression (or by extension + // for a block). These rules differ from the stated C++11 rules only in + // that they remove top-level cv-qualifiers. if (!CurContext->isDependentContext()) - FnRetType = RetValExp->getType(); + FnRetType = RetValExp->getType().getUnqualifiedType(); else FnRetType = CurCap->ReturnType = Context.DependentTy; } else { |