D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6867 - inout and nested foreach loops
Summary: inout and nested foreach loops
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-10-30 11:21 UTC by siegelords_abode
Modified: 2011-10-31 12:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description siegelords_abode 2011-10-30 11:21:41 UTC
DMD version: 2.056

inout(char)[] test(inout(char)[] a)
{
	foreach(dchar d; a) // No error if 'dchar' is removed
	{
		foreach(c; a) // line 5
		{
			
		}
	}
	return [];
}

test.d(5): Error: variable test.test.__foreachbody3.__aggr4 inout variables can only be declared inside inout functions
test.d(5): Error: variable test.test.__foreachbody3.c inout variables can only be declared inside inout functions