summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/spaceship-scalar1-neg.C
blob: 182bf2b909260d992edbc8e6b19ebb005ef5c5bc (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
// { dg-do compile { target c++2a } }

#include <compare>

#define assert(X) do { if (!(X)) __builtin_abort(); } while(0)

void f(){}
void g(){}

int main()
{
  {
    const auto v = &f <=> &g;	// { dg-error "invalid operands" }
  }

  {
    struct A { int i; int j; };
    constexpr auto v = &A::i <=> &A::j; // { dg-error "invalid operands" }
  }

  {
    struct A { void f(); };
    constexpr auto v = &A::f <=> &A::f; // { dg-error "invalid operands" }
  }
}