summaryrefslogtreecommitdiff
path: root/mcs/errors/cs1655.cs
blob: ac6c22aa0f60932210112da636378557139d7319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// CS1655: Cannot pass members of `q' as ref or out arguments because it is a `foreach iteration variable'
// Line: 23

using System.Collections;

struct P {
	public int x;
}

struct Q {
	public P p;
}

class Test {
	static void bar (out int x) { x = 0; }
	static IEnumerable foo () { return null; }

	static void Main ()
	{
		IEnumerable f = foo ();
		if (f != null)
			foreach (Q q in f)
				bar (out q.p.x);
	}
}