-
-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 15044 - destroy might leak memory
Defer semantic3 running of generated `opAssign` function, and add special error gagging mechanism in `FuncDeclaration.semantic3()` to hide errors from its body.
- Loading branch information
Showing
6 changed files
with
104 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
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 @@ | ||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail15044.d(30): Error: function fail15044.V.opAssign is not callable because it is annotated with @disable | ||
| --- | ||
| */ | ||
|
|
||
| struct S | ||
| { | ||
| void opAssign(S) {} | ||
| } | ||
|
|
||
| struct V | ||
| { | ||
| // `s` has opAssign, so struct V needs to generate member-wise opAssign. | ||
| // But S.opAssign is not callable on const object, so V.opAssign should be | ||
| // @disable. | ||
| const S s; | ||
|
|
||
| // Here, the initializer of x is evaluated in V.semantic2. But | ||
| // V.opAssign.semantic3 is not yet invoked, so its attribute should be | ||
| // lazily inferred in functionSemantic even though it's non-instantiated function. | ||
| enum int x = () | ||
| { | ||
| // Here, the initializer of x is evaluated in V.semantic2, and | ||
| // V.opAssign.semantic3 is not yet invoked in this time. | ||
| // Therefore its @disable attribute needs to be inferred by | ||
| // functionSemantic, even though it's non-instantiated function. | ||
| V v; | ||
| v = 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