Fix #77204.
authorRaja R Harinath <harinath@hurrynot.org>
Wed, 11 Jan 2006 12:59:40 +0000 (12:59 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Wed, 11 Jan 2006 12:59:40 +0000 (12:59 -0000)
* mcs/expression.cs (MemberAccess.DoResolve): Disallow the use of '.'
on operands of 'void' type.
* errors/cs0023-3.cs: New test from #77204.

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

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

index e8e9461b28ff5f232f5bd8ac0563983b13370eaf..434ef4c2e6fede3f6b8d6177efa3ccbeb7d0fe36 100644 (file)
@@ -1,3 +1,7 @@
+2006-01-11  Raja R Harinath  <rharinath@novell.com>
+
+       * cs0023-3.cs: New test from #77204.
+
 2006-01-06  Ankit Jain  <jankit@novell.com>
 
        * known-issues-gmcs: Removed cs0619-18.cs and cs0619-24.cs (working now).
diff --git a/mcs/errors/cs0023-3.cs b/mcs/errors/cs0023-3.cs
new file mode 100644 (file)
index 0000000..5ce866d
--- /dev/null
@@ -0,0 +1,14 @@
+// cs0023-3.cs: The `.' operator can not be applied to operands of type 'void'
+// Line: 12
+
+using System; 
+public class Testing 
+{ 
+       public static void DoNothing() {} 
+        
+       public static void Main() 
+       { 
+               Console.WriteLine(DoNothing().ToString()); 
+       } 
+} 
index 0ef54576d8ad8ee49b4561d68fdeb5811df077f7..a4d4cf0ed5bf55c47289873e60d35647eecc1ab3 100644 (file)
@@ -11,6 +11,7 @@
 # csXXXX.cs NO ERROR   : error test case doesn't report any error. An exception is considered
 #                        as NO ERROR and CS5001 is automatically ignored.
 
+cs0023-3.cs
 cs0229-2.cs
 cs0229.cs NO ERROR
 cs0231-2.cs
index fa18e7b046b4763c1d1d9e992cbea489255e200c..c5c5cbfb3670e641b77140a87c805ca7e4b63756 100644 (file)
@@ -1,5 +1,9 @@
 2006-01-11  Raja R Harinath  <rharinath@novell.com>
 
+       Fix #77204.
+       * expression.cs (MemberAccess.DoResolve): Disallow the use of '.'
+       on operands of 'void' type.
+
        Fix #77200.
        * cfold.cs (BinaryFold): Implement folding of BinaryOr, BinaryAnd
        and ExclusiveOr for boolean constants too.
index c0762f08936c43383c4e4b4202899592a1df41fd..710bc26733eaa6b80203be604453d23344f22110 100644 (file)
@@ -7039,6 +7039,11 @@ namespace Mono.CSharp {
                                return null;
                        }
 
+                       if (expr_type == TypeManager.void_type) {
+                               Error (23, "The `.' operator can not be applied to operands of type 'void'");
+                               return null;
+                       }
+
                        Expression member_lookup;
                        member_lookup = MemberLookupFinal (ec, expr_type, expr_type, Identifier, loc);
                        if (member_lookup == null)