www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15089] New: Marks wrong line as where error occurs.

https://issues.dlang.org/show_bug.cgi?id=15089

          Issue ID: 15089
           Summary: Marks wrong line as where error occurs.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jjohnsonjj1251 gmail.com

Code:
enum Pieces : ubyte
{
  Empty,
  Pawn,
  Rook,
  Knight,
  Bishop,
  Queen,
  King
}

int color = 0b10000000;

...

byte[64] pieces;

...

pieces[i] = color ^ Pieces.Rook;

Explanation:
The compiler marked the error as occurring in the enum saying that 129 was too
large to store in a byte when the error should have occurred in the last line
where 129 was actually being assigned to a byte value.

--
Sep 20 2015