Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 4733 - Possible bugs caused by dynamic arrays in boolean ev…
…aluation context Turn it into a warning
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 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,28 @@ | ||
/* | ||
REQUIRED_ARGS: -w | ||
PERMUTE_ARGS: | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/warn4733.d(20): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(21): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(22): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(23): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(24): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(25): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(26): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
fail_compilation/warn4733.d(27): Warning: implicit conversion of dynamic arrays to bool can be ambiguous and will be deprecated. Use one of: arr !is null, arr.length, or arr.ptr instead | ||
--- | ||
*/ | ||
|
||
void main() | ||
{ | ||
int[] arr; | ||
assert(arr); | ||
assert(!arr); | ||
assert(arr || 0); | ||
assert(arr && 1); | ||
assert(arr ? true : false); | ||
do {} while(arr); | ||
for (; arr;) {} | ||
if (arr) {} | ||
} |