]> granicus.if.org Git - clang/commitdiff
Fix an off by one error when trying to perform copy initialization of operator new...
authorAnders Carlsson <andersca@mac.com>
Sun, 31 May 2009 19:49:47 +0000 (19:49 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 31 May 2009 19:49:47 +0000 (19:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprCXX.cpp
test/SemaCXX/new-delete.cpp

index 73cc0513f0489a355c31129d897ccb4190ea7d8f..a44dcf6f8bf505310e9ed8bff03ee12e3b4dd58f 100644 (file)
@@ -550,7 +550,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
     // 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;
index 2f763e0f78aaed612b410ab0382db3bdaf41253b..f890bf56e36bea82f203c8ad9f38b414748dd8ad 100644 (file)
@@ -21,6 +21,7 @@ struct V : U
 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 @@ void good_news()
   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 {