Skip to content

Commit

Permalink
[std.regex] Fix unsafe casts to bool
Browse files Browse the repository at this point in the history
These are disallowed in `@safe` code with
dlang/dmd#16558.
  • Loading branch information
ntrel authored and dlang-bot committed Jun 3, 2024
1 parent 45f7b06 commit ccd3115
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions std/regex/internal/ir.d
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ struct Bytecode
@property bool backreference() const
{
assert(code == IR.GroupStart || code == IR.GroupEnd);
return cast(bool)(raw & 1 << 23);
return (raw & 1 << 23) != 0;
}

//mark as local reference (for backrefs in lookarounds)
Expand All @@ -332,7 +332,7 @@ struct Bytecode
@property bool localRef() const
{
assert(code == IR.Backref);
return cast(bool)(raw & 1 << 23);
return (raw & 1 << 23) != 0;
}

//human readable name of instruction
Expand Down

0 comments on commit ccd3115

Please sign in to comment.