summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/concepts/intro4.C
blob: 0b275e14bf2cfc04674bc12c4e008be34c10b8ef (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 C1 = true;

template<int ... N>
  concept bool C2 = true;

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

template<typename ... T>
  concept bool C4() { return true; }
template<int N>
  concept bool C4() { return true; }

template<typename T, typename U = int>
  concept bool C5() { return __is_class(U); }

C1{...A, B} void f1() {}; // { dg-error "cannot deduce template parameters" }
C1{A} void f2() {}
C2{A, B} void f3() {};
C3{...A} void f4() {}; // { dg-error "cannot be introduced" }
C4{A} void f5() {}; // { dg-error "cannot deduce template parameters" }
C5{A, B} void f6() {};

int main()
{
  // Defaults should not transfer
  f6<int>(); // { dg-error "no matching" }
  return 0;
}