aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/auto-fncast13.C
blob: 1bceffb70cf409fd6a61ced17b7092fbc9ca7f9f (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// PR c++/112410
// { dg-do compile { target c++23 } }

int f1 (auto(int) -> char);
int f2 (auto x);
int f3 (auto);
int f4 (auto(i));

int v1 (auto(42));
int v2 (auto{42});
int e1 (auto{i}); // { dg-error "not declared" }
int i;
int v3 (auto{i});
int v4 (auto(i + 1));
int v5 (auto(+i));
int v6 (auto(i = 4));

int f5 (auto(i));
int f6 (auto());
int f7 (auto(int));
int f8 (auto(f)(int));
int f9 (auto(...) -> char);
// FIXME: ICEs (PR c++/89867)
//int f10 (auto(__attribute__((unused)) i));
int f11 (auto((i)));
int f12 (auto(i[]));
int f13 (auto(*i));
int f14 (auto(*));

int e2 (auto{}); // { dg-error "invalid use of .auto." }
int e3 (auto(i, i)); // { dg-error "invalid use of .auto." }

char bar (int);
char baz ();
char qux (...);

void
g (int i)
{
  f1 (bar);
  f2 (42);
  f3 (42);
  f4 (42);
  f5 (42);
  f6 (baz);
  f7 (bar);
  f8 (bar);
  f9 (qux);
//  f10 (42);
  f11 (42);
  f12 (&i);
  f13 (&i);
  f14 (&i);

  v1 = 1;
  v2 = 2;
  v3 = 3;
  v4 = 4;
  v5 = 5;
  v6 = 6;
}