[Issue 22313] New: ImportC: Assigning to a typedefed declaration with a cast expression gives strange errors.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 18 07:36:16 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22313
Issue ID: 22313
Summary: ImportC: Assigning to a typedefed declaration with a
cast expression gives strange errors.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
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
--
More information about the Digitalmars-d-bugs
mailing list