[Mono-bugs] [Bug 394347] New: Anonymous delegates do strange things.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun May 25 05:19:58 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=394347
Summary: Anonymous delegates do strange things.
Product: Mono: Compilers
Version: 1.2.6
Platform: x86
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: novell at depon.net
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Description of Problem:
Wrong compilation of anonymous delegates
Steps to reproduce the problem:
1.
using System;
using System.Collections.Generic;
using System.Text;
delegate object FactoryDelegate();
public class C
{
Dictionary<string, FactoryDelegate> T =
new Dictionary<string, FactoryDelegate>();
public void X()
{
T["ABC"] = delegate()
{
Console.WriteLine ( "A" );
return "Return";
};
}
static void Main ( String[] strArgs )
{
var o = new C();
o.X();
Console.WriteLine ( "B" );
Console.WriteLine ( o.T [ "ABC" ]());
}
}
2.
mbrenn at dingo-ubuntu:~/Desktop$ gmcs -langversion:linq test.cs
test.cs(16,33): warning CS0162: Unreachable code detected
Compilation succeeded - 1 warning(s)
mbrenn at dingo-ubuntu:~/Desktop$ mono test.exe
B
Return
Actual Results:
Wrong output of compiler, wrong output of executable
Expected Results:
c:\Users\mbrenn\Desktop>csc test.cs
Microsoft (R) Visual C# 2008 Compiler Version 3.5.21022.8
, für Microsoft (R) .NET Framework Version 3.5
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
c:\Users\mbrenn\Desktop>test
B
A
Return
How often does this happen?
Everytime
Additional Information:
Also on Gentoo with Mono 1.9.0 (selfcompiled).
Sry for short bug report, but this marvelous bugreporter has eaten my former
tries twice.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list