view gcc/testsuite/gdc.test/fail_compilation/fail11426.d @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

/*
TEST_OUTPUT:
---
fail_compilation/fail11426.d(15): Error: cannot implicitly convert expression `udarr` of type `uint[]` to `int[]`
fail_compilation/fail11426.d(16): Error: cannot implicitly convert expression `usarr` of type `uint[1]` to `int[]`
fail_compilation/fail11426.d(18): Error: cannot implicitly convert expression `udarr` of type `uint[]` to `int[]`
fail_compilation/fail11426.d(19): Error: cannot implicitly convert expression `usarr` of type `uint[1]` to `int[]`
---
*/
void main()
{
    uint[]  udarr;
    uint[1] usarr;

    int[1] arr1; arr1 = udarr;  // Error, OK
    int[1] arr2; arr2 = usarr;  // Error, OK

    int[1] arr3 = udarr;    // accepted, BAD!
    int[1] arr4 = usarr;    // accepted, BAD!
}