How can I have those "template instance recursive expansion" errors under control?

realhet real_het at hotmail.com
Sun Dec 1 14:11:25 UTC 2024


On Sunday, 1 December 2024 at 00:08:02 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> The trick for such a function, is you have the public wrappers 
> that sanitize the input into something that you want to work 
> with, then internally have a function that accepts only that 
> input.

I'm putting things out into smaller functions.
Now I have az image2D_impl() too. And 3 more. But the recursive 
expansion error is still there.

Now I tracked down wich specific error is that:
"%s `%s` recursive expansion"
It has 2 occurences in dmd/dsymbolsem.d

I thint it's the 2nd one.
```d
if (doSemantic3)
             tempinst.trySemantic3(sc2);

         TemplateInstance ti = tempinst.tinst;
         int nest = 0;
         while (ti && !ti.deferred && ti.tinst)
         {
             ti = ti.tinst;
             if (++nest > global.recursionLimit)
             {
                 global.gag = 0; // ensure error message gets 
printed
                 .error(tempinst.loc, "%s `%s` recursive 
expansion", tempinst.kind, tempinst.toPrettyChars);
                 fatal();
             }
         }
```

But how can a standard template like CommonType or isNumeric go 
nuts recursively? o.O

I will check them, maybe they don't like my Vector/Image 
structs...


More information about the Digitalmars-d-learn mailing list