Mercurial > hg > CbC > CbC_gcc
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/g++.dg/cpp2a/array-conv6.C Thu Feb 13 11:34:05 2020 +0900 @@ -0,0 +1,28 @@ +// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound. +// { dg-do run { target c++2a } } + +// Ranking of reference initialization conversions + +int f1(const int(&)[]) { return 1; } +int f1(const int(&)[1]) { return 2; } + +int f2(const int(&)[]) { return 1; } +int f2(int(&)[1]) { return 2; } + +int f3(int(&)[]) { return 1; } +int f3(const int(&)[1]) { return 2; } + +const int arr[1] = { 42 }; + +int +main () +{ + if (f1(arr) != 2) + __builtin_abort (); + + if (f2(arr) != 1) + __builtin_abort (); + + if (f3(arr) != 2) + __builtin_abort (); +}