view gcc/testsuite/g++.dg/concepts/partial-spec6.C @ 111:04ced10e8804

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

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

template <class T>
concept bool HasType = requires { typename T::type; };

template<class T>
struct trait {
  using type = void;
};

struct has_type { using type = void; };

// Instantiation here
trait<has_type>::type foo() {}

// constrained version here. Type "has_type" would fail this
// constraint so this partial specialization would not have been
// selected.
template<class T>
  requires !HasType<T>
struct trait<T> {
  using type = void;
};