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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1852 - you get opCall missing when cast to a struct(diagnostic)
Summary: you get opCall missing when cast to a struct(diagnostic)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: diagnostic
Depends on:
Blocks:
Reported: 2008年02月19日 05:03 UTC by david
Modified: 2014年02月24日 15:33 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description david 2008年02月19日 05:03:10 UTC
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 david 2008年02月19日 05:04:25 UTC
it's not implicitly , just the cast should be banned. 
Comment 2 sa 2008年02月19日 12:12:27 UTC
Even it's banned, the compiler should give better message to the user.
Comment 3 Walter Bright 2008年03月07日 00:32:19 UTC
Fixed dmd 1.028 and 2.012


AltStyle によって変換されたページ (->オリジナル) /