-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 24051 - Safety attrib inference of enum/immut/const decls (#15434)
* Fix 24051 - Safety attrib inference of enum/immut/const decls * Make `INVALID_HANDLE_VALUE` @trusted * Push and pop scopes
- Loading branch information
Showing
5 changed files
with
33 additions
and
3 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 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,26 @@ | ||
/* | ||
REQUIRED_ARGS: -preview=systemVariables | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/systemvariables_var_init.d(21): Error: cannot access `@system` variable `ptrEnum` in @safe code | ||
fail_compilation/systemvariables_var_init.d(22): Error: cannot access `@system` variable `ptrConst` in @safe code | ||
fail_compilation/systemvariables_var_init.d(24): Error: cannot access `@system` variable `ptrVar` in @safe code | ||
--- | ||
*/ | ||
|
||
// https://issues.dlang.org/show_bug.cgi?id=24051 | ||
|
||
enum uint* ptrEnum = cast(uint*) 0xC00000; | ||
const uint* ptrConst = cast(uint*) 0xC00000; | ||
uint* ptrVarSafe = null; | ||
uint* ptrVar = cast(uint*) 0xC00000; | ||
@trusted uint* ptrTrusted = cast(uint*) 0xC00000; | ||
|
||
void varInitializers() @safe | ||
{ | ||
*ptrEnum = 0; | ||
*ptrConst = 0; | ||
*ptrVarSafe = 0; | ||
*ptrVar = 0; | ||
*ptrTrusted = 0; | ||
} |
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