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