1 // No PCH:
2 // RUN: %clang_cc1 -pedantic -fsized-deallocation -std=c++1z -include %s -verify %s
3 //
4 // With PCH:
5 // RUN: %clang_cc1 -pedantic -fsized-deallocation -std=c++1z -emit-pch %s -o %t
6 // RUN: %clang_cc1 -pedantic -fsized-deallocation -std=c++1z -include-pch %t -verify %s
7 
8 // expected-no-diagnostics
9 
10 #ifndef HEADER
11 #define HEADER
12 
13 using size_t = decltype(sizeof(0));
14 
15 // Call the overaligned form of 'operator new'.
16 struct alignas(256) Q { int n; };
17 void *f() { return new Q; }
18 
19 // Extract the std::align_val_t type from the implicit declaration of operator delete.
20 template<typename AlignValT>
21 AlignValT extract(void (*)(void*, size_t, AlignValT));
22 using T = decltype(extract(&operator delete));
23 
24 #else
25 
26 // ok, calls aligned allocation via placement syntax
27 void *q = new (T{16}) Q;
28 
29 namespace std {
30   enum class align_val_t : size_t {};
31 }
32 
33 using T = std::align_val_t; // ok, same type
34 
35 #endif
36