summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/pull12941.d
blob: b0208686fe1e7c349016df897f94bea9a6dddc86 (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
/* TEST_OUTPUT:
---
fail_compilation/pull12941.d(110): Error: `pull12941.foo` called with argument types `(int*)` matches both:
fail_compilation/pull12941.d(101):     `pull12941.foo(ref return scope int* p)`
and:
fail_compilation/pull12941.d(102):     `pull12941.foo(out return scope int* p)`
fail_compilation/pull12941.d(111): Error: function `pull12941.bar(return scope int* p)` is not callable using argument types `(int)`
fail_compilation/pull12941.d(111):        cannot pass argument `1` of type `int` to parameter `return scope int* p`
fail_compilation/pull12941.d(112): Error: function `pull12941.abc(return ref int* p)` is not callable using argument types `(int)`
fail_compilation/pull12941.d(112):        cannot pass rvalue argument `1` of type `int` to parameter `return ref int* p`
---
 */

/*********************************/
// Tests for https://github.com/dlang/dmd/pull/12941

#line 100

int* foo(ref scope return int* p);
int* foo(out scope return int* p);

int* bar(scope return int* p);
int* abc(ref return int* p);

void test()
{
    int* p;
    foo(p);
    bar(1);
    abc(1);
}