Thread overview
[Issue 21785] Cannot declare variable of opaque enum with base type
Apr 02, 2021
Dlang Bot
Apr 04, 2021
Dlang Bot
April 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21785

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #1 from moonlightsentinel@disroot.org ---
(In reply to moonlightsentinel from comment #0)
> [...] `var` can just be initialized by `void*.init`.

This isn't correct for all opaque enums so the code is rightfully rejected.

Added `diagnostic` because the error message is wrong.

--
April 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21785

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

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

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@MoonlightSentinel updated dlang/dmd pull request #12325 "Fix 21785 - Improve error messages for opaque enums" fixing this issue:

- Fix 21785 - Improve error messages for opaque enums

  The error messages for default initialized variables of opaque enums
  were horrid and contained misleading informations.
  This PR removes them by by checking whether semantic was already
  run in case of an enum without members.

  Some examples:

  ```d
  enum NoBase;
  enum WithBase : long;

  // Not handled yet
  struct S;
  enum OpaqueBase : S;

  void main()
  {
      NoBase nb;
      WithBase wb;
      OpaqueBase ob;
  }
  ```

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

--
April 04, 2021
https://issues.dlang.org/show_bug.cgi?id=21785

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

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12325 "Fix 21785 - Improve error messages for opaque enums" was merged into master:

- 92d1d59eb61f776e98b28deb75b6f64374b0e03b by MoonlightSentinel:
  Fix 21785 - Improve error messages for opaque enums

  The error messages for default initialized variables of opaque enums
  were horrid and contained misleading informations.
  This PR removes them by by checking whether semantic was already
  run in case of an enum without members.

  Some examples:

  ```d
  enum NoBase;
  enum WithBase : long;

  // Not handled yet
  struct S;
  enum OpaqueBase : S;

  void main()
  {
      NoBase nb;
      WithBase wb;
      OpaqueBase ob;
  }
  ```

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

--