[Issue 22432] New: ImportC: casting member of parenthesized struct to typedef’d type is parsed incorrectly
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 22 23:24:26 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22432
Issue ID: 22432
Summary: ImportC: casting member of parenthesized struct to
typedef’d type is parsed incorrectly
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 c program fails to compile:
// test.c
struct Foo {
int x;
};
typedef int int32_t;
void foo(void){
struct Foo f = {1};
int x0 = ((int)(f).x);
int x1 = (int)(f).x;
int32_t x2 = (int32_t)(f).x; // Error
int32_t x3 = ((int32_t)(f).x); // Error
int32_t x4 = (int32_t)f.x;
}
// test.c(11): Error: `=`, `;` or `,` expected
// test.c(12): Error: found `.` when expecting `)`
// test.c(12): Error: missing comma
// test.c(12): Error: `=`, `;` or `,` expected
Works with builtin types, fails with typedef’d types.
--
More information about the Digitalmars-d-bugs
mailing list