-
-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
314 additions
and
312 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| // REQUIRED_ARGS: -o- | ||
|
|
||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail_arrayop1.d(11): Error: invalid array operation a + a (possible missing []) | ||
| --- | ||
| */ | ||
| void test2199(int[] a) // Issue 2199 - Segfault using array operation in function call (from fail266.d) | ||
| { | ||
| test2199(a + a); | ||
| } | ||
|
|
||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail_arrayop1.d(29): Error: invalid array operation -a (possible missing []) | ||
| --- | ||
| */ | ||
| void fail323() // from fail323.d, maybe was a part of issue 3471 fix? | ||
| { | ||
| void foo(double[]) {} | ||
|
|
||
| auto a = new double[10], | ||
| b = a.dup, | ||
| c = a.dup, | ||
| d = a.dup; | ||
|
|
||
| foo(-a); | ||
| // a[] = -(b[] * (c[] + 4)) + 5 * d[]; // / 3; | ||
| } | ||
|
|
||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail_arrayop1.d(54): Error: invalid array operation -a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(55): Error: invalid array operation ~a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(56): Error: invalid array operation a + a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(57): Error: invalid array operation a - a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(58): Error: invalid array operation a * a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(59): Error: invalid array operation a / a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(60): Error: invalid array operation a % a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(61): Error: invalid array operation a ^^ a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(62): Error: invalid array operation a & a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(63): Error: invalid array operation a | a (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(64): Error: invalid array operation a ^ a (possible missing []) | ||
| --- | ||
| */ | ||
| void test3903() | ||
| { | ||
| int[] a = [1, 2]; | ||
| int[] r; | ||
|
|
||
| r = -a; | ||
| r = ~a; | ||
| r = a + a; | ||
| r = a - a; | ||
| r = a * a; | ||
| r = a / a; | ||
| r = a % a; | ||
| r = a ^^ a; | ||
| r = a & a; | ||
| r = a | a; | ||
| r = a ^ a; | ||
| } | ||
|
|
||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail_arrayop1.d(85): Error: invalid array operation a += a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(86): Error: invalid array operation a -= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(87): Error: invalid array operation a *= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(88): Error: invalid array operation a /= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(89): Error: invalid array operation a %= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(90): Error: invalid array operation a ^= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(91): Error: invalid array operation a &= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(92): Error: invalid array operation a |= a[] (possible missing []) | ||
| fail_compilation/fail_arrayop1.d(93): Error: invalid array operation a ^^= a[] (possible missing []) | ||
| --- | ||
| */ | ||
| void test9459() | ||
| { | ||
| int[] a = [1, 2, 3]; | ||
|
|
||
| a += a[]; | ||
| a -= a[]; | ||
| a *= a[]; | ||
| a /= a[]; | ||
| a %= a[]; | ||
| a ^= a[]; | ||
| a &= a[]; | ||
| a |= a[]; | ||
| a ^^= a[]; | ||
| } | ||
|
|
||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail_arrayop1.d(111): Error: invalid array operation 'x1[] = x2[] * x3[]' because X doesn't support necessary arithmetic operations | ||
| fail_compilation/fail_arrayop1.d(115): Error: invalid array operation 's2[] += s1[]' because string is not a scalar type | ||
| fail_compilation/fail_arrayop1.d(119): Error: invalid array operation 'pa1[] *= pa2[]' for element type int* | ||
| --- | ||
| */ | ||
| void test11376() | ||
| { | ||
| struct X { } | ||
|
|
||
| auto x1 = [X()]; | ||
| auto x2 = [X()]; | ||
| auto x3 = [X()]; | ||
| x1[] = x2[] * x3[]; | ||
|
|
||
| string[] s1; | ||
| string[] s2; | ||
| s2[] += s1[]; | ||
|
|
||
| int*[] pa1; | ||
| int*[] pa2; | ||
| pa1[] *= pa2[]; | ||
| } | ||
|
|
||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail_arrayop1.d(131): Error: invalid array operation a[] <<= 1 (possible missing []) | ||
| --- | ||
| */ | ||
| void test11566() | ||
| { | ||
| int[] a; | ||
| a[] <<= 1; | ||
| } |
Oops, something went wrong.