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 #8738 from wolframw/issue_19246
Fix Issue 19246 - Binary literal `0b_` allowed
- Loading branch information
Showing
3 changed files
with
32 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Deprecate invalid binary literals | ||
|
||
Prior to this release, binary literals without any digits after the prefix `0b` | ||
were considered valid. This has now been deprecated. | ||
--- | ||
auto foo = 0b; // deprecated | ||
auto bar = 0b_; // deprecated | ||
auto baz = 0b0; // conforming equivalent | ||
--- |
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,20 @@ | ||
/* REQUIRED_ARGS: -de | ||
* PERMUTE_ARGS: | ||
* TEST_OUTPUT: | ||
--- | ||
fail_compilation/fix19246.d(16): Deprecation: `0b_` isn't a valid integer literal, use `0b0` instead | ||
fail_compilation/fix19246.d(17): Deprecation: `0B_` isn't a valid integer literal, use `0B0` instead | ||
fail_compilation/fix19246.d(18): Deprecation: `0b` isn't a valid integer literal, use `0b0` instead | ||
fail_compilation/fix19246.d(19): Deprecation: `0B` isn't a valid integer literal, use `0B0` instead | ||
--- | ||
*/ | ||
|
||
// https://issues.dlang.org/show_bug.cgi?id=19246 | ||
|
||
void foo() | ||
{ | ||
auto a = 0b_; | ||
auto b = 0B_; | ||
auto c = 0b; | ||
auto d = 0B; | ||
} |