[cfe-commits] r72670 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp
Anders Carlsson
andersca at mac.com
Sun May 31 12:49:47 PDT 2009
Author: andersca
Date: Sun May 31 14:49:47 2009
New Revision: 72670
URL: http://llvm.org/viewvc/llvm-project?rev=72670&view=rev
Log:
Fix an off by one error when trying to perform copy initialization of operator new and operator delete arguments. Sebastian, please review.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=72670&r1=72669&r2=72670&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun May 31 14:49:47 2009
@@ -550,7 +550,7 @@
// asserted on, though, since invalid decls are left in there.)
for (unsigned i = 1; i < NumArgs; ++i) {
// FIXME: Passing word to diagnostic.
- if (PerformCopyInitialization(Args[i-1],
+ if (PerformCopyInitialization(Args[i],
FnDecl->getParamDecl(i)->getType(),
"passing"))
return true;
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=72670&r1=72669&r2=72670&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Sun May 31 14:49:47 2009
@@ -21,6 +21,7 @@
void* operator new(size_t); // expected-note 2 {{candidate}}
void* operator new(size_t, int*); // expected-note 3 {{candidate}}
void* operator new(size_t, float*); // expected-note 3 {{candidate}}
+void* operator new(size_t, S); // expected-note 2 {{candidate}}
void good_news()
{
@@ -39,6 +40,8 @@
U *pu = new (ps) U;
// FIXME: Inherited functions are not looked up currently.
//V *pv = new (ps) V;
+
+ pi = new (S(1.0f, 2)) int;
}
struct abstract {
More information about the cfe-commits
mailing list