summaryrefslogtreecommitdiff
path: root/mcs/errors/cs1654.cs
blob: 6d6a28cb0b1e2a912ca02193bb04246814bd4e08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// CS1654: Cannot assign to members of `p' because it is a `foreach iteration variable'
// Line: 18

using System.Collections;

struct P {
	public int x;
}

class Test {
	static IEnumerable foo () { return null; }

	static void Main ()
	{
		IEnumerable f = foo ();
		if (f != null)
			foreach (P p in f)
				p.x = 0;
	}
}