Daily bump.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / array-conv3.C
blob1ce041e8f2ab6e2f459d61516b8b9c16dd0fb42a
1 // PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
2 // { dg-do run { target c++20 } }
4 // Ranking of reference initialization conversions
6 int f(int(&)[]) { return 1; }       // (1)
7 int f(int(&)[1]) { return 2; }      // (2)
9 int h(int(*)[]) { return 1; }       // (a)
10 int h(int(*)[1]) { return 2; }      // (b)
12 // From P0388R4:
13 // (2) and (b) should clearly be better than (1) and (a), respectively,
14 // as the former overloads are more restricted. 
15 // (a) should be worse than (b), which is implied by (a) necessitating
16 // a qualification conversion in that case.
18 int
19 main ()
21   int arr[1];
22   if (f(arr) != 2)
23     __builtin_abort ();
24   if (h(&arr) != 2)
25     __builtin_abort ();