Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/array-conv4.C

raw
1 // PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
2 // { dg-do compile { target c++20 } }
3
4 // Ranking of reference initialization conversions
5
6 void f(int(&)[]) {} // (1)
7 //void f(int(&)[1]) { } // (2)
8 void f(int*) { } // (3)
9
10 //void f2(int(&)[]) { } // (1)
11 void f2(int(&)[1]) { } // (2)
12 void f2(int*) { } // (3)
13
14 // From P0388R4:
15 // (3) should be equal to (1) (as it is to (2))
16 // Check that we get "ambiguous overload" errors.
17
18 void
19 doit ()
20 {
21 int arr[1];
22 f(arr); // { dg-error "ambiguous" }
23 f2(arr); // { dg-error "ambiguous" }
24 }