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 #8048 from WalterBright/fix15660
fix Issue 15660 - break immutable with pure function and mutable refe… merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
64 additions
and
25 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
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,23 @@ | ||
/* REQUIRED_ARGS: -dip1000 | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fix17635.d(22): Error: cannot implicitly convert expression `f(& p)` of type `immutable(int)**` to `immutable(int**)` | ||
--- | ||
*/ | ||
// https://issues.dlang.org/show_bug.cgi?id=17635 | ||
// https://issues.dlang.org/show_bug.cgi?id=15660 | ||
|
||
alias T = immutable int; | ||
|
||
T** f(const T** input) pure | ||
{ | ||
T** output; | ||
return output; | ||
} | ||
|
||
void main() | ||
{ | ||
T i; | ||
T* p = &i; | ||
immutable T** r = f(&p); | ||
} |
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,22 @@ | ||
/* REQUIRED_ARGS: -dip1000 | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/test15660.d(20): Error: cannot implicitly convert expression `f(v)` of type `int[]` to `immutable(int[])` | ||
--- | ||
*/ | ||
|
||
// https://issues.dlang.org/show_bug.cgi?id=15660 | ||
|
||
int[] f(ref void[] m) pure | ||
{ | ||
auto result = new int[5]; | ||
m = result; | ||
return result; | ||
} | ||
|
||
void main() | ||
{ | ||
void[] v; | ||
immutable x = f(v); | ||
} | ||
|
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
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