view gcc/testsuite/g++.dg/template/sfinae30.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

// PR c++/79706
// { dg-do compile { target c++11 } }

struct A {
  void operator delete(void*) = delete;
private:
  void operator delete[](void*);
};

extern A *p;

template<typename T>
auto foo(T *t) -> decltype(delete t); // { dg-error "use of deleted function" }

template<typename T>
auto bar(T *t) -> decltype(delete[] t); // { dg-error "private within this context" }

void baz() {
  foo<A>(p); // { dg-error "no match" }
  bar<A>(p); // { dg-error "no match" }
}