Thread overview
[Issue 17267] Forward reference error in recursive template
Nov 25, 2017
Mike
Dec 27, 2017
Simen Kjaeraas
Dec 17, 2022
Iain Buclaw
November 25, 2017
https://issues.dlang.org/show_bug.cgi?id=17267

Mike <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |radu.racariu@gmail.com

--- Comment #1 from Mike <slavo5150@yahoo.com> ---
*** Issue 17230 has been marked as a duplicate of this issue. ***

--
December 27, 2017
https://issues.dlang.org/show_bug.cgi?id=17267

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com

--- Comment #2 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
Another, possibly simplified example:

// Mixed templates
struct S1 {
    S2!()* arr;
}
struct S2()
{
    // struct S1 no size because of forward reference
    private byte[S1.sizeof] payload;
}

It seems to be caused by some ordering issues in DMD, where it tries to calculate the size of S1, notices that it depends on a templated type, and just up and dies.

Note also that these variants compile:

// No templates
struct S3 {
    S4* arr;
}
struct S4 {
    private byte[S3.sizeof] payload;
}

// All templates
struct S5() {
    S6!()* arr;
}
struct S6() {
    private byte[S5!().sizeof] payload;
}
S6!() dummy; // Force instantiation

// Mixed templates, revisited
struct S7() {
    S8* arr;
}
struct S8
{
    private byte[S7!().sizeof] payload;
}

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=17267

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=17267

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19241

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--