Bug 22253 – ImportC expressions inadvertently supporting D properties
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-08-30T04:21:14Z
Last change time
2021-09-30T01:46:03Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
mhh
Comments
Comment #0 by maxhaton — 2021-08-30T04:21:14Z
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);
}
---