2003-02-25 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Wed, 26 Feb 2003 04:25:47 +0000 (04:25 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Wed, 26 Feb 2003 04:25:47 +0000 (04:25 -0000)
* class.cs (MemberBase.CheckParameters): Also check that the type
is unmanaged if it is a pointer.

* expression.cs (SizeOf.Resolve): Add location information.

* statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
a managed type is declared.

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

mcs/mcs/statement.cs

index 2c37537084fd5fc8aaed5c6a7ce8d14f41842787..6fe055eb8f2bd0194c8fd7dad682b3f6c23c3d92 100755 (executable)
@@ -3004,10 +3004,22 @@ namespace Mono.CSharp {
                                foreach (DictionaryEntry de in variables){
                                        string name = (string) de.Key;
                                        VariableInfo vi = (VariableInfo) de.Value;
-
+                                       
                                        if (vi.VariableType == null)
                                                continue;
 
+                                       Type variable_type = vi.VariableType;
+
+                                       if (variable_type.IsPointer){
+                                               //
+                                               // Am not really convinced that this test is required (Microsoft does it)
+                                               // but the fact is that you would not be able to use the pointer variable
+                                               // *anyways*
+                                               //
+                                               if (!TypeManager.VerifyUnManaged (variable_type.GetElementType (), vi.Location))
+                                                       continue;
+                                       }
+                                       
                                        vi.LocalBuilder = ig.DeclareLocal (vi.VariableType);
 
                                        if (CodeGen.SymbolWriter != null)