[llvm-branch-commits] [cfe-branch] r118543 - in /cfe/branches/Apple/whitney: include/clang/AST/ExprCXX.h lib/AST/ExprCXX.cpp test/CodeGenCXX/template-dependent-bind-temporary.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 9 09:30:49 PST 2010
Author: ddunbar
Date: Tue Nov 9 11:30:49 2010
New Revision: 118543
URL: http://llvm.org/viewvc/llvm-project?rev=118543&view=rev
Log:
Merge r118066:
--
Author: Fariborz Jahanian <fjahanian at apple.com>
Date: Tue Nov 2 21:05:53 2010 +0000
Fixes an assertion violation when bind to temporary
expression is a dependent expression.
// rdar: // 8620524 and PR7851
Added:
cfe/branches/Apple/whitney/test/CodeGenCXX/template-dependent-bind-temporary.cpp
Modified:
cfe/branches/Apple/whitney/include/clang/AST/ExprCXX.h
cfe/branches/Apple/whitney/lib/AST/ExprCXX.cpp
Modified: cfe/branches/Apple/whitney/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/AST/ExprCXX.h?rev=118543&r1=118542&r2=118543&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/AST/ExprCXX.h (original)
+++ cfe/branches/Apple/whitney/include/clang/AST/ExprCXX.h Tue Nov 9 11:30:49 2010
@@ -672,8 +672,9 @@
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:
Modified: cfe/branches/Apple/whitney/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/AST/ExprCXX.cpp?rev=118543&r1=118542&r2=118543&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/AST/ExprCXX.cpp (original)
+++ cfe/branches/Apple/whitney/lib/AST/ExprCXX.cpp Tue Nov 9 11:30:49 2010
@@ -534,7 +534,9 @@
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,
Added: cfe/branches/Apple/whitney/test/CodeGenCXX/template-dependent-bind-temporary.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeGenCXX/template-dependent-bind-temporary.cpp?rev=118543&view=auto
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeGenCXX/template-dependent-bind-temporary.cpp (added)
+++ cfe/branches/Apple/whitney/test/CodeGenCXX/template-dependent-bind-temporary.cpp Tue Nov 9 11:30:49 2010
@@ -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');
+}
+
More information about the llvm-branch-commits
mailing list