Thread overview
[Issue 22665] ImportC: qualified enum values should be of enum type on the D side, not int
[Issue 22665] ImportC: enums are not "implicitly converting" to their own type.
4 days ago
Walter Bright
4 days ago
Walter Bright
4 days ago
Walter Bright
4 days ago
Dlang Bot
3 days ago
Dlang Bot
6 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

dave287091@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
The trouble here is that in C11, 6.7.2.2-3 says "The identifiers in an enumerator list are declared as constants that have type int". I'll see what I can do.

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

--- Comment #2 from dave287091@gmail.com ---
(In reply to Walter Bright from comment #1)
> The trouble here is that in C11, 6.7.2.2-3 says "The identifiers in an enumerator list are declared as constants that have type int". I'll see what I can do.

6.7.2.4 specifies that "Each enumerated type shall be compatible with char, a signed integer type, or an unsigned integer type. The choice of type is implementation-defined) but shall be capable of representing the values of all the members of the enumeration.”, so the value will always fit.

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

--- Comment #3 from dave287091@gmail.com ---
(In reply to dave287091 from comment #2)
> (In reply to Walter Bright from comment #1)
> ...
> 6.7.2.4
> ...

Sorry, 6.7.2.2-4

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
"shall be capable of representing the values of" is not the same as being the same type.

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ImportC: enums are not      |ImportC: qualified enum
                   |"implicitly converting" to  |values should be of enum
                   |their own type.             |type on the D side, not int

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #13520 "fix Issue 22665 - ImportC: qualified enum values should be of enum ty…" fixing this issue:

- fix Issue 22665 - ImportC: qualified enum values should be of enum type on the D side, not int

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

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

--- Comment #6 from dave287091@gmail.com ---
(In reply to Walter Bright from comment #4)
> "shall be capable of representing the values of" is not the same as being the same type.

Yes, but it means that the implicit conversion is safe, in the same way that converting a short to an int is safe, or that (int & 0x7f) is allowed to implicitly convert to byte.

--
3 days ago
https://issues.dlang.org/show_bug.cgi?id=22665

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13520 "fix Issue 22665 - ImportC: qualified enum values should be of enum ty…" was merged into master:

- 0cff8651a892fa3fbfb8564e83c75ac214f7c585 by Walter Bright:
  fix Issue 22665 - ImportC: qualified enum values should be of enum type on
the D side, not int

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

--