• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++1z -fsized-deallocation -fexceptions -verify %s
2 
3 using size_t = decltype(sizeof(0));
4 
5 namespace std { enum class align_val_t : size_t {}; }
6 
7 // p2 says "A template instance is never a usual deallocation function,
8 // regardless of its signature." We (and every other implementation) assume
9 // this means "A function template specialization [...]"
10 template<typename...Ts> struct A {
11   void *operator new(size_t);
12   void operator delete(void*, Ts...) = delete; // expected-note 4{{deleted}}
13 };
14 
15 auto *a1 = new A<>; // expected-error {{deleted}}
16 auto *a2 = new A<size_t>; // expected-error {{deleted}}
17 auto *a3 = new A<std::align_val_t>; // expected-error {{deleted}}
18 auto *a4 = new A<size_t, std::align_val_t>; // expected-error {{deleted}}
19 auto *a5 = new A<std::align_val_t, size_t>; // ok, not usual
20