[PR #4948] Add explicit to bool operators of Point and Rect #26044

Open
opened 2026-01-31 09:13:35 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/4948

State: closed
Merged: Yes


Found a bug where the following won't work:

COORD inclusiveEnd{ _end };

where _end is a til::point.

The only fix for this is to replace these instances with this:

COORD inclusiveEnd = _end;

What was happening in the first notation is the implicit conversion of til::point to bool to SHORT. The constructor for COORD only sees one SHORT so it thinks the value should be the definition for X, and Y should stay as 0. So we end up getting 1, 0.

By adding the explicit keyword to the bool operators, we prevent the accident above from occurring.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/4948 **State:** closed **Merged:** Yes --- Found a bug where the following won't work: ```c++ COORD inclusiveEnd{ _end }; ``` where `_end` is a `til::point`. The only fix for this is to replace these instances with this: ```c++ COORD inclusiveEnd = _end; ``` What was happening in the first notation is the implicit conversion of `til::point` to `bool` to `SHORT`. The constructor for COORD only sees one SHORT so it thinks the value should be the definition for X, and Y should stay as 0. So we end up getting `1, 0`. By adding the explicit keyword to the bool operators, we prevent the accident above from occurring.
claunia added the pull-request label 2026-01-31 09:13:35 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26044