Lines Matching defs:new
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple=i686-pc-linux-gnu -Wno-new-returns-null
14 // A special new, to verify that the global version isn't used.
15 void* operator new(size_t, S*); // expected-note {{candidate}}
24 inline void *operator new(size_t) { // no warning, due to __attribute__((used))
29 void* operator new(const size_t); // expected-note 2 {{candidate}}
30 void* operator new(size_t, int*); // expected-note 3 {{candidate}}
31 void* operator new(size_t, float*); // expected-note 3 {{candidate}}
32 void* operator new(size_t, S); // expected-note 2 {{candidate}}
38 int *pi = new int;
39 float *pf = new (pi) float();
40 pi = new int(1);
41 pi = new int('c');
42 const int *pci = new const int();
43 S *ps = new S(1, 2, 3.4);
44 ps = new (pf) (S)(1, 2, 3.4);
45 S *(*paps)[2] = new S*[*pi][2];
47 ia4 *pai = new (int[3][4]);
48 pi = ::new int;
49 U *pu = new (ps) U;
50 V *pv = new (ps) V;
52 pi = new (S(1.0f, 2)) int;
54 (void)new int[true];
58 foo* f1 = new foo;
59 foo* f2 = new foo[2];
62 x* f3 = new y;
72 (void)new; // expected-error {{expected a type}}
73 (void)new 4; // expected-error {{expected a type}}
74 (void)new () int; // expected-error {{expected expression}}
75 (void)new int[1.1]; // expected-error {{array size expression must have integral or enumeration type, not 'double'}}
76 (void)new int[1][i]; // expected-error {{only the first dimension}} expected-note {{read of non-const variable 'i' is not allowed in a constant expression}}
77 (void)new (int[1][i]); // expected-error {{only the first dimension}} expected-note {{read of non-const variable 'i' is not allowed in a constant expression}}
78 (void)new (int[i]); // expected-warning {{when type is in parentheses}}
79 (void)new int(*(S*)0); // expected-error {{no viable conversion from 'S' to 'int'}}
80 (void)new int(1, 2); // expected-error {{excess elements in scalar initializer}}
81 (void)new S(1); // expected-error {{no matching constructor}}
82 (void)new S(1, 1); // expected-error {{call to constructor of 'S' is ambiguous}}
83 (void)new const int; // expected-error {{default initialization of an object of const type 'const int'}}
84 (void)new float*(ip); // expected-error {{cannot initialize a new value of type 'float *' with an lvalue of type 'int *'}}
86 (void)new int[-1]; // expected-error {{array size is negative}}
87 (void)new int[2000000000]; // expected-error {{array is too large}}
88 (void)new int[*(S*)0]; // expected-error {{array size expression must have integral or enumeration type, not 'S'}}
89 (void)::S::new int; // expected-error {{expected unqualified-id}}
90 (void)new (0, 0) int; // expected-error {{no matching function for call to 'operator new'}}
91 (void)new (0L) int; // expected-error {{call to 'operator new' is ambiguous}}
93 (void)::new ((S*)0) U; // expected-error {{no matching function for call to 'operator new'}}
95 (void)new U; // expected-error {{no matching function for call to 'operator new'}}
96 (void)new (int[]); // expected-error {{array size must be specified in new expressions}}
97 (void)new int&; // expected-error {{cannot allocate reference type 'int &' with new}}
160 static void *operator new(signed char) throw(); // expected-error {{'operator new' takes type size_t}}
161 static int operator new[] (size_t) throw(); // expected-error {{operator new[]' must return type 'void *'}}
174 new Thai(dict);
178 void* operator new(T size, int); // expected-error {{'operator new' cannot take a dependent type as first parameter; use size_t}}
223 void* operator new(size_t, void*);
227 using X12::operator new;
232 return new (g) X13();
251 new X15(); // expected-error {{calling a private constructor}}
255 namespace PR5918 { // Look for template operator new overloads.
256 struct S { template<typename T> static void* operator new(size_t, T); };
258 (void)new(0) S;
265 (void)new int[10](1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
268 (void)new T(1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
273 (void)new T[1](i); // expected-error {{array 'new' cannot have initialization arguments}}
278 (void)new T(i); // expected-error {{array 'new' cannot have initialization arguments}}
288 void* operator new(size_t);
292 void* operator new(size_t, void*); // expected-note {{declared private here}}
296 void* operator new(size_t); // expected-note {{declared private here}}
303 (void)new S1();
304 (void)new (0L) S1(); // expected-error {{is a private member}}
305 (void)new S2(); // expected-error {{is a private member}}
324 return new (int[T::value]); // expected-warning{{when type is in parentheses, array cannot have dynamic size}}
359 void* operator new(const size_t size);
360 template<class T> void* operator new(const size_t, const int, T*);
378 // the unexpected placement 'operator new'.
382 void *operator new(size_t s, double d = 0);
390 return new A<int>();
396 new DoesNotExist; // expected-error {{unknown type name 'DoesNotExist'}}
404 return new B[5]; // expected-note {{implicit destructor for 'ArrayNewNeedsDtor::B' first required here}}
428 inline void *operator new[](size_t, const PlacementArg &) throw () {
439 S() { new Inner[1]; }
447 new (*(PlacementArg*)0) T[1];
465 CopyCounter* f = new CopyCounter[10](CopyCounter()); // expected-error {{cannot have initialization arguments}}
475 Foo() : a_(new scoped_array<int>[5]) { }
485 Foo2() : a_(new scoped_array2<int>[5]) { }
499 new MessageLoop;
522 inline void *operator new(size_t); // expected-error {{'operator new' cannot be declared inside a namespace}}
526 inline void* operator new(); // expected-error {{'operator new' must have at least one parameter}}