comparison gcc/testsuite/g++.dg/cpp2a/array-conv6.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
2 // { dg-do run { target c++2a } }
3
4 // Ranking of reference initialization conversions
5
6 int f1(const int(&)[]) { return 1; }
7 int f1(const int(&)[1]) { return 2; }
8
9 int f2(const int(&)[]) { return 1; }
10 int f2(int(&)[1]) { return 2; }
11
12 int f3(int(&)[]) { return 1; }
13 int f3(const int(&)[1]) { return 2; }
14
15 const int arr[1] = { 42 };
16
17 int
18 main ()
19 {
20 if (f1(arr) != 2)
21 __builtin_abort ();
22
23 if (f2(arr) != 1)
24 __builtin_abort ();
25
26 if (f3(arr) != 2)
27 __builtin_abort ();
28 }