Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward referencing issue #20553

Open
dlangBugzillaToGithub opened this issue Nov 25, 2024 · 0 comments
Open

Forward referencing issue #20553

dlangBugzillaToGithub opened this issue Nov 25, 2024 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Manu reported this on 2024-11-25T06:11:36Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24878

Description

struct Container(T)
{
    // T.sizeof/alignof causes circular reference!
    enum AllocAlignment = T.sizeof;

    T* ptr;
}

struct Test
{
    Container!Test test;
}

error : struct `main.Test` no size because of forward reference
error : template instance `main.Container!(Test)` error instantiating


Checking T.sizeof causes a forward referencing error; but it doesn't need to evaluate that enum to determine the size of `Container!T` which has a know-able size with no T knowledge... evaluation should be deferred.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant