blob: 7f653da362f65d9d36418a92c91c94af2905c32a (
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.cs: 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);
}
}
|