forked from OSchip/llvm-project
Fixes an assertion violation when bind to temporary
expression is a dependent expression. // rdar: // 8620524 and PR7851 llvm-svn: 118066
This commit is contained in:
parent
8e7cb6dcfa
commit
dba351df64
|
@ -672,8 +672,9 @@ class CXXBindTemporaryExpr : public Expr {
|
|||
|
||||
Stmt *SubExpr;
|
||||
|
||||
CXXBindTemporaryExpr(CXXTemporary *temp, Expr* subexpr)
|
||||
: Expr(CXXBindTemporaryExprClass, subexpr->getType(), false, false),
|
||||
CXXBindTemporaryExpr(CXXTemporary *temp, Expr* subexpr,
|
||||
bool TD=false, bool VD=false)
|
||||
: Expr(CXXBindTemporaryExprClass, subexpr->getType(), TD, VD),
|
||||
Temp(temp), SubExpr(subexpr) { }
|
||||
|
||||
public:
|
||||
|
|
|
@ -534,7 +534,9 @@ CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C,
|
|||
assert(SubExpr->getType()->isRecordType() &&
|
||||
"Expression bound to a temporary must have record type!");
|
||||
|
||||
return new (C) CXXBindTemporaryExpr(Temp, SubExpr);
|
||||
return new (C) CXXBindTemporaryExpr(Temp, SubExpr,
|
||||
SubExpr->isTypeDependent(),
|
||||
SubExpr->isValueDependent());
|
||||
}
|
||||
|
||||
CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C,
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
// rdar: //8620524
|
||||
// PR7851
|
||||
struct string {
|
||||
string (const string& );
|
||||
string ();
|
||||
~string();
|
||||
};
|
||||
|
||||
string operator + (char ch, const string&);
|
||||
|
||||
template <class T>
|
||||
void IntToString(T a)
|
||||
{
|
||||
string result;
|
||||
T digit;
|
||||
char((digit < 10 ? '0' : 'a') + digit) + result;
|
||||
}
|
||||
|
||||
int main() {
|
||||
// CHECK: define linkonce_odr void @_Z11IntToStringIcEvT_(
|
||||
IntToString('a');
|
||||
}
|
||||
|
Loading…
Reference in New Issue