view gcc/testsuite/g++.dg/cpp2a/explicit16.C @ 152:2b5abeee2509

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

// PR c++/95066 - explicit malfunction with dependent expression.
// { dg-do compile { target c++2a } }

template <typename T>
struct Foo {
  template <typename U>
  explicit(static_cast<U>(true)) operator Foo<U>();
};

template <typename T>
template <typename U>
Foo<T>::operator Foo<U>() {
  return {};
}

int
main ()
{
  Foo<float> a;
  Foo<int> b = a; // { dg-error "conversion" }
}