-
-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue 17502: Allow no parameters in out contract for auto methods
Even in case of non-void methods, their out contract should be able to accept no arguments. For the methods with auto return type, there was oversight where one argument to `out` was always assumed.
- Loading branch information
Showing
2 changed files
with
40 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,30 @@ | ||
| class Foo | ||
| { | ||
| auto foo() | ||
| out {} | ||
| body {} | ||
|
|
||
| auto bar() | ||
| out { assert (__result > 5); } | ||
| body { return 6; } | ||
|
|
||
| auto bar_2() | ||
| out (res) { assert (res > 5); } | ||
| body { return 6; } | ||
|
|
||
| int concrete() | ||
| out { assert(__result > 5); } | ||
| body { return 6; } | ||
|
|
||
| int concrete_2() | ||
| out(res) { assert (res > 5); } | ||
| body { return 6; } | ||
|
|
||
| void void_foo() | ||
| out {} | ||
| body {} | ||
|
|
||
| auto void_auto() | ||
| out {} | ||
| body {} | ||
| } |