You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void main() {
uint x = 6;
char digit1 = (x % 10) + '0'; // OK
char digit2 = (x < 10) ? (x + '0') : '#'; // Error.
}
DMD 2.064alpha gives:
test.d(4): Error: cannot implicitly convert expression (x < 10u ? x + 48u : 35u) of type uint to char
I think the line with digit2 should compile.
(Every useless cast removed from the code reduces the chance of bugs).
The text was updated successfully, but these errors were encountered:
bearophile_hugs reported this on 2013-08-03T03:22:23Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=10749
Description
void main() { uint x = 6; char digit1 = (x % 10) + '0'; // OK char digit2 = (x < 10) ? (x + '0') : '#'; // Error. } DMD 2.064alpha gives: test.d(4): Error: cannot implicitly convert expression (x < 10u ? x + 48u : 35u) of type uint to char I think the line with digit2 should compile. (Every useless cast removed from the code reduces the chance of bugs).The text was updated successfully, but these errors were encountered: