Skip to content

bool conversion produces vcc 2019 warning at cpp compilation stage #13744

Closed
@cooldome

Description

@cooldome

The following example produces warning with cpp target and vcc 2019:

var i = 1
let x = bool(i)
echo x

vcc 2019 warning:

a.nim(4): warning C4804: '<': unsafe use of type 'bool' in operation
a.nim(4): warning C4804: '>': unsafe use of type 'bool' in operation

Warning is produced on the following generated range check code:

if ((i) < NIM_FALSE || (i) > NIM_TRUE){ raiseRangeErrorI(i, NIM_FALSE, NIM_TRUE); }
x = ((NIM_BOOL) (i));

< and > comparison with true and false is not quite correct cpp.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions