mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

* Fix issue 20369 - shadowed variable in foreach loop always considered "foreach variable" * Remove unintuitive phrase in deprecation message * Fix deprecation message in test * Add original variable's line information in deprecation (error) message
22 lines
679 B
D
22 lines
679 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail110.d(19): Error: variable `i` is shadowing variable `fail110.main.i`
|
|
fail_compilation/fail110.d(17): declared here
|
|
fail_compilation/fail110.d(20): Error: variable `i` is shadowing variable `fail110.main.i`
|
|
fail_compilation/fail110.d(17): declared here
|
|
fail_compilation/fail110.d(21): Error: variable `i` is shadowing variable `fail110.main.i`
|
|
fail_compilation/fail110.d(17): declared here
|
|
---
|
|
*/
|
|
|
|
// https://issues.dlang.org/show_bug.cgi?id=297
|
|
// Shadowing declarations allowed in foreach type lists
|
|
void main()
|
|
{
|
|
int i;
|
|
int[] a;
|
|
foreach (i; a) {}
|
|
foreach (size_t i, n; a) {}
|
|
for (int i;;) {}
|
|
}
|