On Sunday, 10 February 2013 at 03:24:37 UTC, Jonathan M Davis wrote:
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.

I figured as much. Very difficult to figure out the culprit when it's from bitfields mixed with perfectly normal code for assignment.

Where should I add to the bug tracker so the error message can be improved?

Reply via email to