-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 21936 - Segfault with -dip1000
- Loading branch information
1 parent
fea011e
commit 4ce4209
Showing
3 changed files
with
45 additions
and
1 deletion.
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,4 @@ | ||
struct S | ||
{ | ||
private int field; | ||
} |
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,32 @@ | ||
/* REQUIRED_ARGS: -preview=dip1000 -Ifail_compilation/imports | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/issue21936.d(15): Error: struct `issue21936s.S` member `field` is not accessible from `@safe` code | ||
fail_compilation/issue21936.d(15): Error: struct `issue21936s.S` member `field` is not accessible from `@safe` code | ||
fail_compilation/issue21936.d(11): Error: template instance `issue21936.constructImplicit!(S)` error instantiating | ||
fail_compilation/issue21936.d(7): instantiated from here: `registerConstructors!(S)` | ||
fail_compilation/issue21936.d(21): instantiated from here: `registerType!(S)` | ||
--- | ||
*/ | ||
#line 2 | ||
module issue21936; | ||
import issue21936s; | ||
struct Handlers { | ||
void registerType(T)() | ||
{ | ||
registerConstructors!T; | ||
} | ||
void registerConstructors(T)() | ||
{ | ||
constructImplicit!T; | ||
} | ||
} | ||
|
||
auto constructImplicit(T)(typeof(T.init.tupleof) x = T.init.tupleof) | ||
{ | ||
} | ||
|
||
void registerHandlersDateTime(Handlers handlers) | ||
{ | ||
handlers.registerType!(S); | ||
} |