Merge pull request #3769 from evincarofautumn/fix-verify-before-allocs
[mono.git] / mcs / errors / cs1654-2.cs
1 // CS1654: Cannot assign to members of `q' because it is a `foreach iteration variable'
2 // Line: 22
3
4 using System.Collections;
5
6 struct P {
7         public int x;
8 }
9
10 struct Q {
11         public P p;
12 }
13
14 class Test {
15         static IEnumerable foo () { return null; }
16
17         static void Main ()
18         {
19                 IEnumerable f = foo ();
20                 if (f != null)
21                         foreach (Q q in f)
22                                 q.p.x = 0;
23         }
24 }