view gcc/testsuite/g++.dg/concepts/partial-spec6.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

// PR c++/67152
// { dg-do compile { target c++17 } }
// { dg-options "-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;
};