[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / microsoft-new-delete.cpp
blobbeba4d9dd8a45da8e6bd80f684b3960cab979607
1 // RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify -std=c++11 %s
3 #include <stddef.h>
5 struct arbitrary_t {} arbitrary;
6 void *operator new(size_t size, arbitrary_t);
8 void f() {
9 // Expect no error in MSVC compatibility mode
10 int *p = new(arbitrary) int[4];
13 class noncopyable { noncopyable(const noncopyable&); } extern nc; // expected-note {{here}}
14 void *operator new[](size_t, noncopyable);
15 void *operator new(size_t, const noncopyable&);
16 void *q = new (nc) int[4]; // expected-error {{calling a private constructor}}
18 struct bitfield { int n : 3; } bf; // expected-note {{here}}
19 void *operator new[](size_t, int &); // expected-note {{passing argument to parameter here}}
20 void *operator new(size_t, const int &);
21 void *r = new (bf.n) int[4]; // expected-error {{non-const reference cannot bind to bit-field}}
23 struct base {};
24 struct derived : private base {} der; // expected-note {{here}}
25 void *operator new[](size_t, base &);
26 void *operator new(size_t, derived &);
27 void *s = new (der) int[4]; // expected-error {{private}}
29 struct explicit_ctor { explicit explicit_ctor(int); };
30 struct explicit_ctor_tag {} ect;
31 void *operator new[](size_t, explicit_ctor_tag, explicit_ctor);
32 void *operator new(size_t, explicit_ctor_tag, int);
33 void *t = new (ect, 0) int[4];
34 void *u = new (ect, {0}) int[4]; // expected-warning {{braces around scalar init}}