summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-05-13 19:56:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-05-13 19:56:21 +0000
commitd6f9e73527fb48ade3580f45e03c4590defbf109 (patch)
tree1fe42912290b0562521f8997d58a7da2e41c8f9a /clang/test
parentaddf51ddde4f06a471b3c40ef8300d6c88919185 (diff)
downloadbcm5719-llvm-d6f9e73527fb48ade3580f45e03c4590defbf109.tar.gz
bcm5719-llvm-d6f9e73527fb48ade3580f45e03c4590defbf109.zip
PR19729: Delete a bunch of bogus code in Sema::FindAllocationOverload. This
caused us to perform copy-initialization for the parameters of an allocation function called by a new-expression multiple times, resulting in us rejecting allocations that passed non-copyable parameters (and much worse things in MSVC compat mode, where we potentially called this function multiple times). llvm-svn: 208724
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-constructor.cpp14
-rw-r--r--clang/test/SemaCXX/microsoft-new-delete.cpp26
2 files changed, 36 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
index dc179f81bd3..2b443fce781 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
+++ b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
struct one { char c[1]; };
struct two { char c[2]; };
@@ -304,7 +304,6 @@ namespace init_list_default {
B b {}; // calls default constructor
}
-
// PR13470, <rdar://problem/11974632>
namespace PR13470 {
struct W {
@@ -365,3 +364,14 @@ namespace PR13470 {
yi.h(); // ok, all diagnostics produced in template definition
}
}
+
+namespace PR19729 {
+ struct A {
+ A(int);
+ A(const A&) = delete;
+ };
+ struct B {
+ void *operator new(std::size_t, A);
+ };
+ B *p = new ({123}) B;
+}
diff --git a/clang/test/SemaCXX/microsoft-new-delete.cpp b/clang/test/SemaCXX/microsoft-new-delete.cpp
index e0d25dcd86f..6c9be228935 100644
--- a/clang/test/SemaCXX/microsoft-new-delete.cpp
+++ b/clang/test/SemaCXX/microsoft-new-delete.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify -std=c++11 %s
#include <stddef.h>
@@ -10,3 +9,26 @@ void f() {
// Expect no error in MSVC compatibility mode
int *p = new(arbitrary) int[4];
}
+
+class noncopyable { noncopyable(const noncopyable&); } extern nc; // expected-note {{here}}
+void *operator new[](size_t, noncopyable);
+void *operator new(size_t, const noncopyable&);
+void *q = new (nc) int[4]; // expected-error {{calling a private constructor}}
+
+struct bitfield { int n : 3; } bf; // expected-note {{here}}
+void *operator new[](size_t, int &);
+void *operator new(size_t, const int &);
+void *r = new (bf.n) int[4]; // expected-error {{non-const reference cannot bind to bit-field}}
+
+struct base {};
+struct derived : private base {} der; // expected-note {{here}}
+void *operator new[](size_t, base &);
+void *operator new(size_t, derived &);
+void *s = new (der) int[4]; // expected-error {{private}}
+
+struct explicit_ctor { explicit explicit_ctor(int); };
+struct explicit_ctor_tag {} ect;
+void *operator new[](size_t, explicit_ctor_tag, explicit_ctor);
+void *operator new(size_t, explicit_ctor_tag, int);
+void *t = new (ect, 0) int[4];
+void *u = new (ect, {0}) int[4];
OpenPOWER on IntegriCloud