D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21218 - dtoh: protection attributes should be emitted to headers
Summary: dtoh: protection attributes should be emitted to headers
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: bootcamp, pull
Depends on:
Blocks:
 
Reported: 2020-09-03 21:12 UTC by Seb
Modified: 2020-10-15 07:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Seb 2020-09-03 21:12:15 UTC
```
extern(C++) struct Foo {
  protected int a = 1;
}
```

generates currently:

```
struct Foo
{
    int32_t a;
    Foo() {}
};
```

expected:

```
struct Foo
{
    protected int32_t a;
    Foo() {}
};
```
Comment 1 Seb 2020-09-03 21:14:55 UTC
This also applies to `private` and likely all other protection attributes:

```
extern(C++) struct Foo {
  private int a = 1;
}
```

generates currently:

```
struct Foo
{
    int32_t a;
    Foo() {}
};
```
Comment 2 Dlang Bot 2020-09-28 11:11:08 UTC
@MoonlightSentinel created dlang/dmd pull request #11804 "Fix 21218 - protection attributes should be emitted to C++ headers" fixing this issue:

- Fix 21218 - protection attributes should be emitted to C++ headers
  
  Properly track the current protection while writing struct/class members
  and add `public:`, `protected:` or `private:` as necessary.
  
  `package` and `package(...)` is currently mapped to `protected` as there
  is no real equivalent in C++.

https://github.com/dlang/dmd/pull/11804
Comment 3 Dlang Bot 2020-10-15 07:29:06 UTC
dlang/dmd pull request #11804 "Fix 21218 - protection attributes should be emitted to C++ headers" was merged into master:

- f0ebacdb3b8e91cbeb42ed86f2123dada7f68658 by MoonlightSentinel:
  Fix 21218 - protection attributes should be emitted to C++ headers
  
  Properly track the current protection while writing struct/class members
  and add `public:`, `protected:` or `private:` as necessary.
  
  `package` and `package(...)` is currently mapped to `protected` as there
  is no real equivalent in C++.

https://github.com/dlang/dmd/pull/11804