view gcc/testsuite/g++.dg/DRs/dr2237.C @ 152:2b5abeee2509

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

// DR 2237 - Can a template-id name a constructor?

template<class T>
struct X {
  X<T>(); // { dg-error "expected" "" { target c++20 } }
  X(int); // OK, injected-class-name used
  ~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } }
};

// ill-formed since DR1435
template<typename T> X<T>::X<T>() {} // { dg-error "names the constructor|as no template constructors" }
template<typename T> X<T>::~X<T>() {} // { dg-error "template-id not allowed for destructor" "" { target c++20 } }

struct Q {
  // ill-formed since DR1435
  template<typename T> friend X<T>::X<T>(); // { dg-error "names the constructor|as no template constructors" }
  template<typename T> friend X<T>::~X<T>(); // { dg-error "template-id not allowed for destructor" "" { target c++20 } }
};