[Mono-bugs] [Bug 691061] New: mcs fails to report CS0201 for lambda for void return delegate & parenthesized expression
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Apr 30 11:24:21 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=691061
https://bugzilla.novell.com/show_bug.cgi?id=691061#c0
Summary: mcs fails to report CS0201 for lambda for void return
delegate & parenthesized expression
Classification: Mono
Product: Mono: Compilers
Version: SVN
Platform: Other
OS/Version: openSUSE 11.4
Status: NEW
Severity: Minor
Priority: P5 - None
Component: C#
AssignedTo: msafar at novell.com
ReportedBy: aenomoto at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
The following example shows that
the lambda expression
that takes a delegate
whose return value is void
fails to reject parenthesized expression:
$ cat x.cs
using System;
public class X
{
static Action<int> x;
public static void Main ()
{
string s = null;
x = i => (s = "ABCDE".Substring (0, i));
x (3);
Console.WriteLine (s);
}
}
atsushi at monkeytimeline2 ~/tests
$ mcs x.cs
atsushi at monkeytimeline2 ~/tests
$ csc x.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
x.cs(10,12): error CS0201: Only assignment, call, increment, decrement, and new
object expressions can be used as a statement
If it is not Action but Func (i.e. with some return value) .NET also does not
reject such a parenthesized expression. I'm not sure which behavior is
conformant to ECMA C# specification.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list