[Issue 21468] New: Inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 10 21:46:15 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21468

          Issue ID: 21468
           Summary: Inscrutable template error when core.stdcpp.vector of
                    a struct with a core.stdcpp.vector field is referenced
                    before the struct's definition
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: n8sh.secondary at hotmail.com

Related discussion at
https://forum.dlang.org/thread/efjydhujahujqjrvmnsk@forum.dlang.org

Fails with "dmd -m64" on Microsoft Windows:
---
import core.stdcpp.vector: stdcpp_vector = vector;

void foo(stdcpp_vector!(S)* s) {}

struct S
{
    stdcpp_vector!int a;
}

void main(){}
---
main.d(7): Error: struct core.stdcpp.vector.vector(T, Alloc = allocator!T)
recursive template expansion
main.d(7):        while looking for match for stdcpp_vector!(int,
allocator!int)
......\src\druntime\import\core\stdcpp\vector.d(33): Error: template instance
core.stdcpp.allocator.allocator!(S) error instantiating
main.d(3):        instantiated from here: stdcpp_vector!(S)

Succeeds with "dmd -m64" on Microsoft Windows:
---
import core.stdcpp.allocator: allocator;
import core.stdcpp.vector: stdcpp_vector = vector;

void foo(stdcpp_vector!(S, allocator!S)* s) {}

struct S
{
    stdcpp_vector!int a;
}

void main(){}
---

--


More information about the Digitalmars-d-bugs mailing list