-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5876 from WalterBright/fix15672
fix Issue 15672 - Casting from void[] to T[] is erroneously considere…
- Loading branch information
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
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
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,38 @@ | ||
/* | ||
* TEST_OUTPUT: | ||
--- | ||
fail_compilation/test15672.d(15): Error: cast from void[] to byte[] not allowed in safe code | ||
fail_compilation/test15672.d(25): Error: cast from void* to byte* not allowed in safe code | ||
--- | ||
*/ | ||
// https://issues.dlang.org/show_bug.cgi?id=15672 | ||
|
||
alias byte T; | ||
alias const(byte) CT; | ||
|
||
@safe T[] test1(void[] a) | ||
{ | ||
return cast(T[])a; | ||
} | ||
|
||
@safe CT[] test2(void[] a) | ||
{ | ||
return cast(CT[])a; | ||
} | ||
|
||
@safe T* test3(void* a) | ||
{ | ||
return cast(T*)a; | ||
} | ||
|
||
@safe CT* test4(void* a) | ||
{ | ||
return cast(CT*)a; | ||
} | ||
|
||
@safe T[] test5() | ||
{ | ||
return cast(T[])[]; | ||
} | ||
|
||
|
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