Recursive template instantiation
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Mar 13 15:59:36 PDT 2017
On 03/13/2017 03:26 PM, Jack Applegame wrote:
> I'm pretty sure that this code should compile
> (https://dpaste.dzfl.pl/cf1e1ee6ef4b):
>
> struct A(T) {
> ~this() {
> char[T.sizeof] data;
> }
> }
>
> struct B(T) {
> A!T foo;
> }
>
> struct C {
> B!C bar;
> }
>
> void main() {
> C c;
> }
>
> But it doesn't:
> /d300/f416.d(3): Error: struct f416.C no size because of forward
> reference /d300/f416.d(12): Error: template instance f416.B!(C) error
> instantiating
It compiles when it's a normal method instead of a destructor:
----
struct A(T) {
void m() {
char[T.sizeof] data;
}
}
/* ... rest as above ... */
----
I don't see how the destructor makes a difference. Soo, bug?
More information about the Digitalmars-d-learn
mailing list