Example #1
0
 concept bool C() { return __is_class(T); }
Example #2
0
// { dg-do compile { target c++14 } }

template<typename T>
  constexpr bool Class = __is_class(T);

template<typename T>
  constexpr bool Test = Class<T>;

struct S { };

static_assert(!Test<int>, "");
static_assert(Test<S>, "");
Example #3
0
 concept bool 
 Class_type() { return __is_class(T); }
Example #4
0
// { dg-options "-std=c++17 -fconcepts" }

template<typename T>
  concept bool C1 = __is_class(T);

template<typename T>
  concept bool C2() { return __is_class(T); }

template<typename T>
  constexpr bool C3 = __is_class(T);


template<typename U>
  requires C1<U>() // { dg-error "" }
  void f1(U) { }

template<typename U>
  requires C2<U> // { dg-error "invalid reference" }
  void f2(U) { }

template<C3 T>  // { dg-error "not a type" }
  void f(T) { } // { dg-error "" }