mirror of https://github.com/microsoft/clang.git
Use SubstInitializer instead of SubstExpr when instantiating a default
argument, in order to correctly instantiate the initializer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284184 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7fd299613f
commit
2875f6c8b4
|
@ -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();
|
||||
|
|
|
@ -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>(); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue