D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21861 - ctfe fails when a nested enum or function has a UDA
Summary: ctfe fails when a nested enum or function has a UDA
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2021-04-25 13:49 UTC by Eyal
Modified: 2021-04-27 10:42 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Eyal 2021-04-25 13:49:27 UTC
CTFE execution fails when nested enums or functions have a UDA on them:

    int f() {
        @("S")
        struct S {}

        @("U")
        union U {}

        @("C")
        class C {}

        // CTFE fails on this:
        @("E")
        enum E { X }

        // CTFE fails on this:
        @("f")
        void f() {}

        return 5;
    }

    static assert(f() == 5);

e.g the enum errors out with:

  Error: declaration `@("E")enum E : int { ... }` is not yet implemented in CTFE
Comment 1 Dlang Bot 2021-04-25 16:46:31 UTC
@BorisCarvajal created dlang/dmd pull request #12472 "Fix Issue 21861 - ctfe fails when a nested enum or function has a UDA" fixing this issue:

- Fix Issue 21861 - ctfe fails when a nested enum or function has a UDA

https://github.com/dlang/dmd/pull/12472
Comment 2 Dlang Bot 2021-04-27 10:42:06 UTC
dlang/dmd pull request #12472 "Fix Issue 21861 - ctfe fails when a nested enum or function has a UDA" was merged into master:

- 1d03b753733017828371b2527dc6cbea4be1304b by Boris Carvajal:
  Fix Issue 21861 - ctfe fails when a nested enum or function has a UDA

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