Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Issue 7050 - PrettyPrint calls to unsafe functions for nicer di…
…agnostic error messages. Add line number for implicitly generated function.
- Loading branch information
1 parent
81860f8
commit ce7d938
Showing
4 changed files
with
61 additions
and
5 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,14 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag7050a.d(5): Error: safe function 'diag7050a.foo' cannot call system function 'diag7050a.Foo.this' | ||
--- | ||
*/ | ||
|
||
#line 1 | ||
struct Foo { | ||
this (int a) {} | ||
} | ||
@safe void foo() { | ||
auto f = Foo(3); | ||
} |
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,15 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag7050b.d(5): Error: pure function 'diag7050b.f.g' cannot call impure function 'diag7050b.f' | ||
--- | ||
*/ | ||
|
||
#line 1 | ||
void f() | ||
{ | ||
pure void g() | ||
{ | ||
f(); | ||
} | ||
} |
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 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag7050c.d(7): Error: safe function 'diag7050c.B.~this' cannot call system function 'diag7050c.A.~this' | ||
--- | ||
*/ | ||
|
||
#line 1 | ||
struct A | ||
{ | ||
~this(){} | ||
} | ||
|
||
@safe struct B | ||
{ | ||
A a; | ||
} | ||
|
||
@safe void f() | ||
{ | ||
auto x = B.init; | ||
} |