Bug 21217 – C++ header generator shouldn't emit private enums
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-09-03T18:04:34Z
Last change time
2020-09-04T01:07:44Z
Keywords
pull
Assigned to
No Owner
Creator
Seb
Comments
Comment #0 by greeenify — 2020-09-03T18:04:34Z
enums aren't part of the layout, so they shouldn't be emitted. Especially when they are private:
```
extern(C++) struct Foo {
int a = 1;
enum b = 2;
private enum c = 3;
protected enum d = 2;
}
```
```
$ dmd -HC -c foo.d
#pragma once
#include <stddef.h>
#include <stdint.h>
#if !defined(ENUM_CONSTANT_NUMERIC)
# define ENUM_CONSTANT_NUMERIC(type, name, value) enum : type { name = value };
#endif
struct Foo
{
int32_t a;
ENUM_CONSTANT_NUMERIC(int32_t, b, 2)
ENUM_CONSTANT_NUMERIC(int32_t, c, 3)
ENUM_CONSTANT_NUMERIC(int32_t, d, 2)
Foo() : a(1) {}
};
```
Comment #1 by dlang-bot — 2020-09-03T18:32:56Z
@wilzbach created dlang/dmd pull request #11679 "Fix Issue 21217 - C++ header generator shouldn't emit private enums" fixing this issue:
- Fix Issue 21217 - C++ header generator shouldn't emit private enums
https://github.com/dlang/dmd/pull/11679
Comment #2 by dlang-bot — 2020-09-04T01:07:44Z
dlang/dmd pull request #11679 "Fix Issue 21217 - C++ header generator shouldn't emit private enums" was merged into master:
- 40c7f51cb9ed6a93653c60480f145ad22b670ca5 by Sebastian Wilzbach:
Fix Issue 21217 - C++ header generator shouldn't emit private enums
https://github.com/dlang/dmd/pull/11679