Page MenuHomeFeedback Tracker

Enscript cast expression bug.
Closed, ResolvedPublic

Description

void function() {
    bool a = (((int)true) | ((int)false)); // error
    int b = (int)true;
    int c = (int)false;
    bool d = b | c; // ok
}

the code above generates a compile error with: "'|' not supported on 'bool'", the issue here is that the cast expression creates no effect, operands to the bitwise or are both (clearly) explicitly casted into an int type thus it should be valid. If the expression is split up, then it works fine (the last three lines).

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Run

void function() {
    bool a = (((int)true) | ((int)false));
    int b = (int)true;
    int c = (int)false;
    bool d = b | c;
}

Event Timeline

sharp1337 updated the task description. (Show Details)
sharp1337 changed Category from General to Scripting.Aug 19 2022, 8:19 PM
Geez changed the task status from New to Assigned.Aug 30 2022, 1:28 PM
Geez closed this task as Resolved.Apr 26 2023, 2:45 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Works as designed according to the devs:

Correct casting is:

bool a = (int)(true | false);