Bug 1852 – you get opCall missing when cast to a struct(diagnostic)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-02-19T05:03:00Z
Last change time
2014-02-24T15:33:38Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
davidl

Comments

Comment #0 by davidl — 2008-02-19T05:03:10Z
struct mystruct{} void main() { mystruct* a= new mystruct; mystruct b= cast(mystruct)a; } teststructnew.d(5): Error: no property 'opCall' for type 'mystruct' teststructnew.d(5): Error: function expected before (), not 1 of type int teststructnew.d(5): Error: no property 'opCall' for type 'mystruct' teststructnew.d(5): Error: function expected before (), not 1 of type int teststructnew.d(5): Error: cannot implicitly convert expression (1(1(a))) of type int to mystruct I think message: cannot implicitly convert from type mystruct* to mystruct would be more clear.
Comment #1 by davidl — 2008-02-19T05:04:25Z
it's not implicitly , just the cast should be banned.
Comment #2 by someanon — 2008-02-19T12:12:27Z
Even it's banned, the compiler should give better message to the user.
Comment #3 by bugzilla — 2008-03-07T00:32:19Z
Fixed dmd 1.028 and 2.012