[Issue 7644] [tdpl] receive( (OwnerTerminated) {} ); fails to compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 5 04:56:30 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7644


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2012-03-05 04:56:28 PST ---
(In reply to comment #2)
> (In reply to comment #1)
> > With:
> > 
> >   class Foo {}
> >   auto a = (Foo) {}; // error
> > 
> > I get with 2.058 and 2.059:
> > 
> >   Error: cannot infer type from ambiguous function literal __lambda2
> > 
> > That's different from what you say you're getting. It's also correct, as the
> > type of parameter Foo cannot be inferred.
> 
> That's the same as what I get. The error message in the post relates to the
> OwnerTerminated code snippet above it.
> 
> I don't understand what you mean with the type inference for the Foo parameter.
> The type is Foo.

The change in 2.058 was that given:
auto a = (x) { ... };
x is a parameter, of type to be inferred.
Previously, it was assumed to be a type.

> Is this an errata for TDPL?

I believe so. Should be rewritten to something like:

void foo() {
    import std.concurrency;
    receive( (OwnerTerminated  x) { } );
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list