Bug 6069 – DMD tries to call static Foo.opCall() on cast(immutable(Foo))

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-28T13:28:00Z
Last change time
2012-04-24T04:19:46Z
Keywords
rejects-valid
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2011-05-28T13:28:17Z
struct Foo { static Foo opCall() { return Foo.init; } } void main() { auto foo = cast(immutable(Foo)) Foo.init; } // test.d(8): Error: function test.Foo.opCall () is not callable using argument types (Foo) // test.d(8): Error: expected 0 arguments, not 1 for non-variadic function type Foo() --- I don't know how DMD could possibly try to call a function inside the cast() type parameter, but it seems like it does. const() instead of immutable() produces the error as well, just cast(Foo) works.
Comment #1 by code — 2011-05-28T13:33:02Z
Oh, forgot to add: I'm using latest Git master (2c1a453).
Comment #2 by lovelydear — 2012-04-23T15:14:49Z
Compiles fine on 2.059 Win32
Comment #3 by code — 2012-04-24T04:19:46Z
Can't reproduce it with latest DMD anymore either, closing.