2009-02-27 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Fri, 27 Feb 2009 12:29:07 +0000 (12:29 -0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 27 Feb 2009 12:29:07 +0000 (12:29 -0000)
* class.cs: Add external constructor error.

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

mcs/mcs/ChangeLog
mcs/mcs/class.cs

index af0040e799040234df2c9572b732d55f71450f03..60e08b1efd46ff1f8bdc123b8d5c71c58a04e5b6 100644 (file)
@@ -1,3 +1,7 @@
+2009-02-27  Marek Safar  <marek.safar@gmail.com>
+
+       * class.cs: Add external constructor error.
+
 2009-02-26  Marek Safar  <marek.safar@gmail.com>
 
        A fix for bug #475354
index 45db34b12fb98402074ce8343d9459e81e33544b..79f5ed1dad740412e8d6e2c567c5e9a71f2d458a 100644 (file)
@@ -3597,11 +3597,16 @@ namespace Mono.CSharp {
                public override void Emit()
                {
                        // for extern static method must be specified either DllImport attribute or MethodImplAttribute.
-                       // We are more strict than Microsoft and report CS0626 as error
+                       // We are more strict than csc and report this as an error because SRE does not allow emit that
                        if ((ModFlags & Modifiers.EXTERN) != 0 && !is_external_implementation) {
-                               Report.Error (626, Location,
-                                       "`{0}' is marked as an external but has no DllImport attribute. Consider adding a DllImport attribute to specify the external implementation",
-                                       GetSignatureForError ());
+                               if (this is Constructor) {
+                                       Report.Error (824, Location,
+                                               "Constructor `{0}' is marked `external' but has no external implementation specified", GetSignatureForError ());
+                               } else {
+                                       Report.Error (626, Location,
+                                               "`{0}' is marked as an external but has no DllImport attribute. Consider adding a DllImport attribute to specify the external implementation",
+                                               GetSignatureForError ());
+                               }
                        }
 
                        base.Emit ();