brintos

brintos / llvm-project-archived public Read only

0
0
Text · 994 B · cccd628 Raw
39 lines · cpp
1// No PCH:2// RUN: %clang_cc1 -pedantic -std=c++1z -include %s -verify %s3//4// With PCH:5// RUN: %clang_cc1 -pedantic -std=c++1z -emit-pch %s -o %t6// RUN: %clang_cc1 -pedantic -std=c++1z -include-pch %t -verify %s7 8// RUN: %clang_cc1 -pedantic -std=c++1z -emit-pch -fpch-instantiate-templates %s -o %t9// RUN: %clang_cc1 -pedantic -std=c++1z -include-pch %t -verify %s10 11// expected-no-diagnostics12 13#ifndef HEADER14#define HEADER15 16using size_t = decltype(sizeof(0));17 18// Call the overaligned form of 'operator new'.19struct alignas(256) Q { int n; };20void *f() { return new Q; }21 22// Extract the std::align_val_t type from the implicit declaration of operator delete.23template<typename AlignValT>24AlignValT extract(void (*)(void*, size_t, AlignValT));25using T = decltype(extract(&operator delete));26 27#else28 29// ok, calls aligned allocation via placement syntax30void *q = new (T{16}) Q;31 32namespace std {33  enum class align_val_t : size_t {};34}35 36using T = std::align_val_t; // ok, same type37 38#endif39