view gcc/testsuite/g++.dg/concepts/req11.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line source

// { dg-options "-std=c++17 -fconcepts" }

// Check that we can evaluate constant requires-expressions
// as constant expressions, for the curious case when they
// appear within predicate constraints.

template<typename... Ts> struct variant { };

template<typename T>
concept bool Streamable()
{
  return requires (T t) { t; };
}

template<typename T>
concept bool Range()
{
  return requires (T t) { t; };
}

template<class T>
  requires Streamable<T>() and not Range<T>()
void print(const T& x) { }

int main()
{
  print("hello"); // { dg-error "cannot call" }
}