Bug 22339 – importC: error message with character literal reports as integer instead of character literal.
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-28T04:19:32Z
Last change time
2022-02-10T06:14:10Z
Keywords
diagnostic, ImportC, pull
Assigned to
No Owner
Creator
dave287091
Comments
Comment #0 by dave287091 — 2021-09-28T04:19:32Z
The following erroneous C program gives an unusual error message:
// err.c
int bar(void){
switch('1'){
case.'1': // erroneous . instead of a space
break;
}
return 0;
}
err.c(4): Error: expression expected, not `.`
err.c(4): Error: found `49` when expecting `:`
err.c(4): Error: found `:` instead of statement
I expected the second error to be reported as a character literal, not as the integer value of the character literal.
I can also trigger it in the following situations:
enum {foo = .'1'};
switch(.'1')
Comment #1 by dlang-bot — 2022-02-10T03:43:41Z
@WalterBright created dlang/dmd pull request #13635 "fix Issue 22339 - importC: error message with character literal repor…" fixing this issue:
- fix Issue 22339 - importC: error message with character literal reports as integer instead of character literal
https://github.com/dlang/dmd/pull/13635
Comment #2 by dlang-bot — 2022-02-10T06:14:10Z
dlang/dmd pull request #13635 "fix Issue 22339 - importC: error message with character literal repor…" was merged into master:
- e0e13493ee81c43091c42a2e3827e43c8b24a2a3 by Walter Bright:
fix Issue 22339 - importC: error message with character literal reports as integer instead of character literal
https://github.com/dlang/dmd/pull/13635