Bug 22313 – ImportC: account for ( ) when doing lookahead on assignment-expressions
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-18T07:36:16Z
Last change time
2021-09-30T01:46:12Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
dave287091
Comments
Comment #0 by dave287091 — 2021-09-18T07:36:16Z
The following small, contrived C program fails to compile.
I am not sure what the problem is here. The error messages are nonsensical.
// cast.c
typedef int Integer;
int castint(int x){
Integer a = (Integer)(x); // cast.c(4)
Integer b = (Integer)(4); // cast.c(5)
Integer c = (Integer)x;
Integer d = (Integer)4;
Integer e = (int)(x); // cast.c(8)
int f = (Integer)x;
Integer g = (int)x;
Integer h = (int)(4); // cast.c(11)
Integer i = (int)4;
int j = (Integer)(x);
return x;
}
cast.c(4): Error: found `=` when expecting `;` or `=`, did you mean `Integer a = (`?
cast.c(4): Error: found `=` instead of statement
cast.c(5): Error: found `=` when expecting `;` or `=`, did you mean `Integer b = (`?
cast.c(5): Error: found `=` instead of statement
cast.c(8): Error: found `=` when expecting `;` or `=`, did you mean `Integer e = (`?
cast.c(8): Error: found `=` instead of statement
cast.c(11): Error: found `=` when expecting `;` or `=`, did you mean `Integer h = (`?
cast.c(11): Error: found `=` instead of statement
Comment #1 by dlang-bot — 2021-09-19T06:23:51Z
@WalterBright created dlang/dmd pull request #13088 "fix Issue 22313 - ImportC: account for ( ) when doing lookahead on as…" fixing this issue:
- fix Issue 22313 - ImportC: account for ( ) when doing lookahead on assignment-expressions
https://github.com/dlang/dmd/pull/13088
Comment #2 by dlang-bot — 2021-09-19T07:54:13Z
dlang/dmd pull request #13088 "fix Issue 22313 - ImportC: account for ( ) when doing lookahead on as…" was merged into stable:
- 462ee3e094132465309676044363be9ebf5eacbf by Walter Bright:
fix Issue 22313 - ImportC: account for ( ) when doing lookahead on assignment-expressions
https://github.com/dlang/dmd/pull/13088
Comment #3 by dlang-bot — 2021-09-30T01:46:12Z
dlang/dmd pull request #13108 "merge stable" was merged into master:
- 714c34ef8629c23751d7071d7dcc1d697708ad13 by Walter Bright:
fix Issue 22313 - ImportC: account for ( ) when doing lookahead on assignment-expressions (#13088)
https://github.com/dlang/dmd/pull/13108