| 1 |
/* |
| 2 |
EXTRA_FILES: imports/constraints.d |
| 3 |
REQUIRED_ARGS: -verrors=context |
| 4 |
TEST_OUTPUT: |
| 5 |
---- |
| 6 |
fail_compilation/constraints_func4.d(90): Error: none of the overloads of template `imports.constraints.overload` are callable using argument types `!()(int)` |
| 7 |
overload(0); |
| 8 |
^ |
| 9 |
fail_compilation/imports/constraints.d(39): Candidates are: `overload(T)(T v)` |
| 10 |
with `T = int` |
| 11 |
must satisfy the following constraint: |
| 12 |
` N!T` |
| 13 |
void overload(T)(T v) if (N!T); |
| 14 |
^ |
| 15 |
fail_compilation/imports/constraints.d(40): `overload(T)(T v)` |
| 16 |
with `T = int` |
| 17 |
must satisfy the following constraint: |
| 18 |
` !P!T` |
| 19 |
void overload(T)(T v) if (!P!T); |
| 20 |
^ |
| 21 |
fail_compilation/imports/constraints.d(41): `overload(T)(T v1, T v2)` |
| 22 |
void overload(T)(T v1, T v2) if (N!T); |
| 23 |
^ |
| 24 |
fail_compilation/imports/constraints.d(42): `overload(T, V)(T v1, V v2)` |
| 25 |
void overload(T, V)(T v1, V v2) if (N!T || N!V); |
| 26 |
^ |
| 27 |
fail_compilation/constraints_func4.d(91): Error: none of the overloads of template `imports.constraints.overload` are callable using argument types `!()(int, string)` |
| 28 |
overload(0, ""); |
| 29 |
^ |
| 30 |
fail_compilation/imports/constraints.d(39): Candidates are: `overload(T)(T v)` |
| 31 |
void overload(T)(T v) if (N!T); |
| 32 |
^ |
| 33 |
fail_compilation/imports/constraints.d(40): `overload(T)(T v)` |
| 34 |
void overload(T)(T v) if (!P!T); |
| 35 |
^ |
| 36 |
fail_compilation/imports/constraints.d(41): `overload(T)(T v1, T v2)` |
| 37 |
void overload(T)(T v1, T v2) if (N!T); |
| 38 |
^ |
| 39 |
fail_compilation/imports/constraints.d(42): `overload(T, V)(T v1, V v2)` |
| 40 |
with `T = int, |
| 41 |
V = string` |
| 42 |
must satisfy one of the following constraints: |
| 43 |
` N!T |
| 44 |
N!V` |
| 45 |
void overload(T, V)(T v1, V v2) if (N!T || N!V); |
| 46 |
^ |
| 47 |
fail_compilation/constraints_func4.d(93): Error: template `variadic` is not callable using argument types `!()()` |
| 48 |
variadic(); |
| 49 |
^ |
| 50 |
fail_compilation/imports/constraints.d(43): Candidate is: `variadic(A, T...)(A a, T v)` |
| 51 |
void variadic(A, T...)(A a, T v) if (N!int); |
| 52 |
^ |
| 53 |
fail_compilation/constraints_func4.d(94): Error: template `variadic` is not callable using argument types `!()(int)` |
| 54 |
variadic(0); |
| 55 |
^ |
| 56 |
fail_compilation/imports/constraints.d(43): Candidate is: `variadic(A, T...)(A a, T v)` |
| 57 |
with `A = int, |
| 58 |
T = ()` |
| 59 |
must satisfy the following constraint: |
| 60 |
` N!int` |
| 61 |
void variadic(A, T...)(A a, T v) if (N!int); |
| 62 |
^ |
| 63 |
fail_compilation/constraints_func4.d(95): Error: template `variadic` is not callable using argument types `!()(int, int)` |
| 64 |
variadic(0, 1); |
| 65 |
^ |
| 66 |
fail_compilation/imports/constraints.d(43): Candidate is: `variadic(A, T...)(A a, T v)` |
| 67 |
with `A = int, |
| 68 |
T = (int)` |
| 69 |
must satisfy the following constraint: |
| 70 |
` N!int` |
| 71 |
void variadic(A, T...)(A a, T v) if (N!int); |
| 72 |
^ |
| 73 |
fail_compilation/constraints_func4.d(96): Error: template `variadic` is not callable using argument types `!()(int, int, int)` |
| 74 |
variadic(0, 1, 2); |
| 75 |
^ |
| 76 |
fail_compilation/imports/constraints.d(43): Candidate is: `variadic(A, T...)(A a, T v)` |
| 77 |
with `A = int, |
| 78 |
T = (int, int)` |
| 79 |
must satisfy the following constraint: |
| 80 |
` N!int` |
| 81 |
void variadic(A, T...)(A a, T v) if (N!int); |
| 82 |
^ |
| 83 |
---- |
| 84 |
*/ |
| 85 |
|
| 86 |
void main() |
| 87 |
{ |
| 88 |
import imports.constraints; |
| 89 |
|
| 90 |
overload(0); |
| 91 |
overload(0, ""); |
| 92 |
|
| 93 |
variadic(); |
| 94 |
variadic(0); |
| 95 |
variadic(0, 1); |
| 96 |
variadic(0, 1, 2); |
| 97 |
} |