1 // RUN: %clang_cc1 -std=c++1z -verify %s
3 using size_t = decltype(sizeof(0));
4 namespace std
{ enum class align_val_t
: size_t {}; }
6 // Aligned version is preferred over unaligned version,
7 // unsized version is preferred over sized version.
8 template<unsigned Align
>
9 struct alignas(Align
) A
{
10 void operator delete(void*);
11 void operator delete(void*, std::align_val_t
) = delete; // expected-note {{here}}
13 void operator delete(void*, size_t) = delete;
14 void operator delete(void*, size_t, std::align_val_t
) = delete;
16 void f(A
<__STDCPP_DEFAULT_NEW_ALIGNMENT__
> *p
) { delete p
; }
17 void f(A
<__STDCPP_DEFAULT_NEW_ALIGNMENT__
* 2> *p
) { delete p
; } // expected-error {{deleted}}
19 template<unsigned Align
>
20 struct alignas(Align
) B
{
21 void operator delete(void*, size_t);
22 void operator delete(void*, size_t, std::align_val_t
) = delete; // expected-note {{here}}
24 void f(B
<__STDCPP_DEFAULT_NEW_ALIGNMENT__
> *p
) { delete p
; }
25 void f(B
<__STDCPP_DEFAULT_NEW_ALIGNMENT__
* 2> *p
) { delete p
; } // expected-error {{deleted}}