view gcc/testsuite/g++.dg/cpp2a/explicit7.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// P0892R2
// { dg-do compile }
// { dg-options "-std=c++2a" }

template<typename T>
struct B {
  static const T value = true;
};

struct X {
  template<typename T>
  explicit(B<T>::value) operator T();
};

int
main ()
{
  X x;
  int i = x.operator int();
  int i3 = x; // { dg-error "cannot convert" }
  int i2{x};
}