[Issue 23699] ImportC: Unclear documentation that struct/union/enum introduce implicit typedefs in ImportC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 20 11:31:03 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23699

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject.org> ---
The term used by C++ is "elaborated type specifier", which is used to
distinguish between types and regular identifiers.

For example, the following code is accepted by both C++ and ImportC
```
struct s { int a; };

void g(int s) {
  struct s* p = (struct s*)malloc(sizeof(struct s));
  p->a = s;
}
```

Whereas this is rejected by both C++ and ImportC, for the same reason.
```
struct s { int a; };

void g(int s) {
  s* p = (s*)malloc(sizeof(s));
  p->a = s;
}
```

--


More information about the Digitalmars-d-bugs mailing list