aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/concepts/inherit-ctor1.C
blob: b137791bbb6a68843f82fee88aa569dbbb34ca84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// { dg-do compile { target c++17_only } }
// { dg-options "-fconcepts" }

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

struct X { };

template<typename T>
  struct Base {
    Base(double) requires C<T> { } 
  };

struct Ok1 : Base<X> {
  using Base<X>::Base;
};

struct Err1 : Base<int> {
  using Base<int>::Base;
};

template<typename T>
  struct Generic : Base<T> {
    using Base<T>::Base;
  };


int main() {
  Ok1 x1(0.0);
  Err1 x2(0.0); // { dg-error "no matching" }
  Generic<X> x3(0.0);
  Generic<int> x4(0.0); // { dg-error "no matching" }
}