view gcc/testsuite/g++.dg/concepts/req2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile { target c++17 } }
// { dg-options "-fconcepts" }

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

void f1(auto a) requires Class<decltype(a)>() { }

// FIXME: This is generating excess errors related to pretty
// printing the trailing requires expression.
void f2(auto a)
  requires requires (decltype(a) x) { -x; }
{ }

struct S { } s;

int main() {
  f1(0); // { dg-error "cannot call" }
  f2((void*)0); // { dg-error "cannot call" }
}