view gcc/testsuite/g++.dg/cpp2a/concepts-conv2.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++/94597
// { dg-do compile { target c++20 } }

template <typename b, typename c> concept d = requires(b e) { e.operator c(); };

template <typename f, typename g> requires(d<f, g>) bool equal(f, g);

template <typename h> struct i {
  i(h);
  operator h();
};

static_assert( d<i<float>, float>);
static_assert(!d<i<float>, int>);

bool fun() {
  i a(2.0f);
  return equal(a, 3.0f);
}