aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-fn8.C
blob: c63d26c931d9e3e7dbdca4b0ac74a715a98d0c25 (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
// PR c++/111703
// { dg-do compile { target c++20 } }

template<class T>
constexpr bool always_true() { return true; }

struct P {
  P() = default;

  template<class T>
    requires (always_true<T>()) // { dg-bogus "used before its definition" }
  constexpr P(const T&) { }

  int n, m;
};

void (*f)(P);
P (*h)(P);

template<class T>
constexpr bool g() {
  P x;
  f(x); // { dg-bogus "from here" }
  f(h(x)); // { dg-bogus "from here" }
  return true;
}