[Mono-bugs] [Bug 378189] New: gmcs requires void-returning invocation in lambda expression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 8 19:33:01 EDT 2008


           Summary: gmcs requires void-returning invocation in lambda
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cmarshall at pacificbiosciences.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

I can't think up a better summary. This code fails to compile:

using System;
using System.Collections;
using System.Collections.Generic;

public static class ext
        static public void Apply<T>(IEnumerable<T> a, Action<T> fn)
                foreach (T ai in a)

public class action
        public static void Main(string[] argv)
                ArrayList list = new ArrayList();
                ext.Apply(argv, str => list.Add(str));

Failing with:

action.cs(19,21): error CS1502: The best overloaded method match for
System.Action<string>)' has some invalid arguments
action.cs(7,28): (Location of the symbol related to previous error)
action.cs(19,21): error CS1503: Argument 2: Cannot convert type `lambda
expression' to `System.Action<string>'
Compilation failed: 2 error(s), 0 warnings

It looks like it was this change:

..which confuses me. Why can't an invocation that returns a non-void type be
used here?

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