diff options
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 3 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/default-arg-temps.cpp | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 45f8ca7515b..e301d789a4d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -4559,7 +4559,8 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, // default argument expression appears. ContextRAII SavedContext(*this, FD); LocalInstantiationScope Local(*this); - Result = SubstExpr(UninstExpr, MutiLevelArgList); + Result = SubstInitializer(UninstExpr, MutiLevelArgList, + /*DirectInit*/false); } if (Result.isInvalid()) return ExprError(); diff --git a/clang/test/CodeGenCXX/default-arg-temps.cpp b/clang/test/CodeGenCXX/default-arg-temps.cpp index 6a7f43a5128..f7b46818e39 100644 --- a/clang/test/CodeGenCXX/default-arg-temps.cpp +++ b/clang/test/CodeGenCXX/default-arg-temps.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s struct T { T(); @@ -71,3 +71,10 @@ namespace test1 { D d; } + +namespace test2 { + // CHECK: define linkonce_odr void @_ZN5test21AIiED2Ev( + template <typename T> struct A { A() {} ~A() {} }; + template <typename> void f(const A<int> & = {}) {} + void g() { f<int>(); } +} |

