Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5183 from AndrejMitrovic/fix-12558
Issue 12558 - Deprecate implicit catch statements
- Loading branch information
Showing
6 changed files
with
62 additions
and
14 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,39 @@ | ||
// REQUIRED_ARGS: | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
compilable/test12558.d(16): Deprecation: catch statement without an exception specification is deprecated; use catch(Throwable) for old behavior | ||
compilable/test12558.d(21): Deprecation: catch statement without an exception specification is deprecated; use catch(Throwable) for old behavior | ||
--- | ||
*/ | ||
|
||
void main() | ||
{ | ||
auto handler = () { }; | ||
|
||
try { | ||
assert(0); | ||
} catch | ||
handler(); | ||
|
||
try { | ||
assert(0); | ||
} catch { | ||
handler(); | ||
} | ||
|
||
// ensure diagnostics are not emitted for verioned-out blocks | ||
version (none) | ||
{ | ||
try { | ||
assert(0); | ||
} catch // should not emit diagnostics | ||
handler(); | ||
|
||
try { | ||
assert(0); | ||
} catch { // ditto | ||
handler(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ void main() | |
{ | ||
break; | ||
} | ||
catch | ||
catch (Throwable) | ||
{ | ||
} | ||
} |
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