[Issue 21217] New: C++ header generator shouldn't emit private enums
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 3 18:04:34 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21217
Issue ID: 21217
Summary: C++ header generator shouldn't emit private enums
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: greeenify at gmail.com
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) {}
};
```
--
More information about the Digitalmars-d-bugs
mailing list