Error: not a property - ?

Jonathan M Davis jmdavisProg at gmx.com
Sat Feb 9 19:23:30 PST 2013


On Sunday, February 10, 2013 04:16:26 Era Scarecrow wrote:
>   This is an unexpected error; Seems it's the result of not
> down-casting a variable-type. Is this a bug? Or just need a
> better error message?
> 
> Version: DMD32 D Compiler v2.061
> 
> 
>    struct S {
>      void test(uint v) @property {}
>      void test2(ulong v) @property {}
>    }
> 
>    ulong x;
>    S s;
> 
>    s.test2 = x;
>    s.test = x;  //s.test is not a property

It's not a bug. The assignment is illegal, because a you can't assign a ulong 
to a uint without casting, but the error message obviously isn't very good. It 
probably gives that error whenever you try and use the property syntax, and 
there's no variable or function with that name that compiles with the given 
argument. It really should be indicating that the argument itself is invalid, 
but however the combination of lowering and error messages works, you end up 
with a less than helpful error message.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list