Thread overview
[Issue 1852] New: you get opCall missing when cast to a struct(diagnostic)
Feb 19, 2008
d-bugmail
Feb 19, 2008
d-bugmail
Feb 19, 2008
d-bugmail
Mar 07, 2008
d-bugmail
February 19, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1852

           Summary: you get opCall missing when cast to a struct(diagnostic)
           Product: D
           Version: 1.026
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: davidl@126.com


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.


-- 

February 19, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1852





------- Comment #1 from davidl@126.com  2008-02-19 05:04 -------
it's not implicitly , just the cast should be banned.


-- 

February 19, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1852





------- Comment #2 from someanon@yahoo.com  2008-02-19 12:12 -------
Even it's banned, the compiler should give better message to the user.


-- 

March 07, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1852


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from bugzilla@digitalmars.com  2008-03-07 00:32 -------
Fixed dmd 1.028 and 2.012


--