summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/array-conv7.C
blob: 07c709ff10f263de57f27de6297cb5d7709e9cb1 (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
// PR c++/69531 - DR 1307, Overload resolution based on size of array init-list.
// { dg-do run { target c++2a } }

int f(int const(&)[]) { return 1; }
int f(int const(&)[2]) { return 2; }

int f2(int const(&)[]) { return 1; }
int f2(int const(&)[1]) { return 2; }

int f3(int const(&)[]) { return 1; }
int f3(int const(&)[1]) { return 2; }
int f3(int const(&)[2]) { return 3; }

int main ()
{
  if (f ({}) != 1)
    __builtin_abort ();
  if (f ({1}) != 1)
    __builtin_abort ();
  if (f ({1, 2}) != 2)
    __builtin_abort ();

  if (f2 ({}) != 1)
    __builtin_abort ();
  if (f2 ({1}) != 2)
    __builtin_abort ();

  if (f3 ({}) != 1)
    __builtin_abort ();
  if (f3 ({1}) != 2)
    __builtin_abort ();
  if (f3 ({1, 2}) != 3)
    __builtin_abort ();
}