www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1852] New: you get opCall missing when cast to a struct(diagnostic)

reply d-bugmail puremagic.com writes:
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.


-- 
Feb 19 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1852






it's not implicitly , just the cast should be banned. 


-- 
Feb 19 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1852






Even it's banned, the compiler should give better message to the user.


-- 
Feb 19 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1852


bugzilla digitalmars.com changed:

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





Fixed dmd 1.028 and 2.012


-- 
Mar 06 2008