[Issue 22253] New: ImportC: Strange things happen with postfix x.y expressions .
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Aug 30 04:21:14 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22253
Issue ID: 22253
Summary: ImportC: Strange things happen with postfix x.y
expressions .
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: maxhaton at gmail.com
Example 1:
---
char* strcpy(char* destination, const char* source);
int puts(char*);
int main()
{
char staticArray[256];
strcpy(staticArray.ptr, "mhh is allergic to pollen");
puts(staticArray.ptr); <- .ptr !
char* copy = staticArray.dup.ptr; <-- Crossing streams...
}
---
Example 2:
---
struct Value {
int state;
};
int main()
{
struct Value x;
struct Value y = {0};
x.init = y;
}
---
Example 3:
---
void use(int state, float monkey);
struct Value {
int state;
float monkey;
};
int main()
{
struct Value x = {0, 3.14};
use(x.tupleof);
}
---
--
More information about the Digitalmars-d-bugs
mailing list