In mcs:
authorRaja R Harinath <harinath@hurrynot.org>
Mon, 26 Sep 2005 11:07:14 +0000 (11:07 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Mon, 26 Sep 2005 11:07:14 +0000 (11:07 -0000)
Fix #76133.
* mcs/expression.cs (This.VerifyFixed): In a value type T, the type of
'this' is T&, iow, 'this' is either an out or ref parameter.  In a
value type R, 'this' is treated as a value parameter.
* tests/test-456.cs: New test from #76133.
* errors/cs0212-3.cs: New test based on #76133.

svn path=/trunk/mcs/; revision=50753

mcs/errors/ChangeLog
mcs/errors/cs0212-3.cs [new file with mode: 0644]
mcs/errors/known-issues-gmcs
mcs/mcs/ChangeLog
mcs/mcs/expression.cs
mcs/tests/ChangeLog
mcs/tests/known-issues-gmcs
mcs/tests/test-456.cs [new file with mode: 0644]

index 88a1c0fc614117b6d062188dcc6214f44397892e..5bed2c9034f78a45fe3cba995c254cc814dc5cea 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-26  Raja R Harinath  <rharinath@novell.com>
+
+       * cs0212-3.cs: New test based on #76133.
+
 2005-09-05  Atsushi Enomoto  <atsushi@ximian.com>
 
        * gcs0208-2.cs, gcs0208-3.cs, gcs0208-4.cs : added test with related
diff --git a/mcs/errors/cs0212-3.cs b/mcs/errors/cs0212-3.cs
new file mode 100644 (file)
index 0000000..03f6562
--- /dev/null
@@ -0,0 +1,21 @@
+// cs0212-3.cs: You can only take the address of unfixed expression inside of a fixed statement initializer
+// Line: 10
+// Compiler options: -unsafe
+
+struct Foo {
+       public float f;
+       public void foo ()
+       {
+               unsafe {
+                       float *pf1 = &f;
+               }
+       }
+}
+
+class Test {
+       static void Main ()
+       {
+               Foo x = new Foo ();
+               x.foo ();
+       }
+}
index ab5f0a7f793163cbc6c781c4556d65620d157e6e..0449fabbc7428eaa7a835acd688687d81939712c 100644 (file)
@@ -14,6 +14,7 @@
 cs0121-3.cs NO ERROR
 cs0201.cs
 cs0202.cs # new in GMCS
+cs0212-3.cs NO ERROR
 cs0229-2.cs
 cs0229.cs NO ERROR
 cs0266-2.cs NO ERROR
@@ -51,4 +52,4 @@ cs0619-43.cs NO ERROR
 cs0619-45.cs NO ERROR
 cs0619-46.cs NO ERROR
 cs0619-31.cs NO ERROR
-cs1674-2.cs
\ No newline at end of file
+cs1674-2.cs
index ee21eb9cee97174f87a1f4883d54d416d6805949..534d3c43a0247a2a6dfe074df01c358be60125c4 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-26  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #76133.
+       * expression.cs (This.VerifyFixed): In a value type T, the type of
+       'this' is T&, iow, 'this' is either an out or ref parameter.  In a
+       value type R, 'this' is treated as a value parameter.
+
 2005-09-22  Miguel de Icaza  <miguel@novell.com>
 
        * statement.cs (Lock): Use the TemporaryVariable class instead of
index 3848f1a1d1af7a04022d87c71cdf21a710dce509..dc534e75704df3ebfa7f2b8af490e61eb929b830 100644 (file)
@@ -7009,8 +7009,7 @@ namespace Mono.CSharp {
 
                public bool VerifyFixed ()
                {
-                       // Treat 'this' as a value parameter for the purpose of fixed variable determination.
-                       return true;
+                       return !TypeManager.IsValueType (Type);
                }
 
                public bool ResolveBase (EmitContext ec)
index aad6c1f0077cb49540580dd252bb078e9f4a2312..0c654212a70e3703aa6a2e45cd375645507a2448 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-26  Raja R Harinath  <rharinath@novell.com>
+
+       * test-456.cs: New test from #76133.
+
 2005-09-15  Raja R Harinath  <rharinath@novell.com>
 
        * test-455.cs: New test.  Distilled from a failing unit test of
index 93fa8ec6e7d6f6caae35deaa2cf142c3e2dd5821..1f331a534109a93a637ff1761b7637b4080dbdda 100644 (file)
@@ -10,6 +10,7 @@ test-439.cs IGNORE            # Compiles to invalid IL
 test-442.cs IGNORE             # Compiles to invalid IL
 test-453.cs IGNORE
 test-454.cs IGNORE
+test-456.cs
 
 test-50.cs IGNORE      # Windows-only test
 test-67.cs IGNORE      # Windows-only test
diff --git a/mcs/tests/test-456.cs b/mcs/tests/test-456.cs
new file mode 100644 (file)
index 0000000..7d2a243
--- /dev/null
@@ -0,0 +1,20 @@
+// Compiler options: -unsafe
+
+struct Foo {
+       public float f;
+       public void foo ()
+       {
+               unsafe {
+                       fixed (float *pf2 = &f) {
+                       }
+               }
+       }
+}
+
+class Test {
+       static void Main ()
+       {
+               Foo x = new Foo ();
+               x.foo ();
+       }
+}