1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify -std=c++11 %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc #include <stddef.h>
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc struct arbitrary_t {} arbitrary;
6f4a2713aSLionel Sambuc void *operator new(size_t size, arbitrary_t);
7f4a2713aSLionel Sambuc
f()8f4a2713aSLionel Sambuc void f() {
9f4a2713aSLionel Sambuc // Expect no error in MSVC compatibility mode
10f4a2713aSLionel Sambuc int *p = new(arbitrary) int[4];
11f4a2713aSLionel Sambuc }
12*0a6a1f1dSLionel Sambuc
13*0a6a1f1dSLionel Sambuc class noncopyable { noncopyable(const noncopyable&); } extern nc; // expected-note {{here}}
14*0a6a1f1dSLionel Sambuc void *operator new[](size_t, noncopyable);
15*0a6a1f1dSLionel Sambuc void *operator new(size_t, const noncopyable&);
16*0a6a1f1dSLionel Sambuc void *q = new (nc) int[4]; // expected-error {{calling a private constructor}}
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel Sambuc struct bitfield { int n : 3; } bf; // expected-note {{here}}
19*0a6a1f1dSLionel Sambuc void *operator new[](size_t, int &);
20*0a6a1f1dSLionel Sambuc void *operator new(size_t, const int &);
21*0a6a1f1dSLionel Sambuc void *r = new (bf.n) int[4]; // expected-error {{non-const reference cannot bind to bit-field}}
22*0a6a1f1dSLionel Sambuc
23*0a6a1f1dSLionel Sambuc struct base {};
24*0a6a1f1dSLionel Sambuc struct derived : private base {} der; // expected-note {{here}}
25*0a6a1f1dSLionel Sambuc void *operator new[](size_t, base &);
26*0a6a1f1dSLionel Sambuc void *operator new(size_t, derived &);
27*0a6a1f1dSLionel Sambuc void *s = new (der) int[4]; // expected-error {{private}}
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc struct explicit_ctor { explicit explicit_ctor(int); };
30*0a6a1f1dSLionel Sambuc struct explicit_ctor_tag {} ect;
31*0a6a1f1dSLionel Sambuc void *operator new[](size_t, explicit_ctor_tag, explicit_ctor);
32*0a6a1f1dSLionel Sambuc void *operator new(size_t, explicit_ctor_tag, int);
33*0a6a1f1dSLionel Sambuc void *t = new (ect, 0) int[4];
34*0a6a1f1dSLionel Sambuc void *u = new (ect, {0}) int[4];
35