D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21468 - Inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition
Summary: Inscrutable template error when core.stdcpp.vector of a struct with a core.st...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-12-10 21:46 UTC by Nathan S.
Modified: 2020-12-21 01:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nathan S. 2020-12-10 21:46:15 UTC
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(){}
---
Comment 1 Dlang Bot 2020-12-10 21:54:54 UTC
@n8sh created dlang/druntime pull request #3309 "Fix inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition" fixing this issue:

- Fix Issue 21468 - Inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition
  
  Related discussion at https://forum.dlang.org/thread/efjydhujahujqjrvmnsk@forum.dlang.org

https://github.com/dlang/druntime/pull/3309
Comment 2 Dlang Bot 2020-12-12 00:05:35 UTC
dlang/druntime pull request #3309 "Fix inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition" was merged into stable:

- 12a56aa5fc19552637634f2cf1e56a250589d1fc by Nathan Sashihara:
  Fix Issue 21468 - Inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition
  
  Related discussion at https://forum.dlang.org/thread/efjydhujahujqjrvmnsk@forum.dlang.org

https://github.com/dlang/druntime/pull/3309
Comment 3 Dlang Bot 2020-12-21 01:01:40 UTC
dlang/druntime pull request #3315 "merge stable" was merged into master:

- 1e64c52ef762049e2f12e55fc1d00dff4bd76d92 by Nathan Sashihara:
  Fix Issue 21468 - Inscrutable template error when core.stdcpp.vector of a struct with a core.stdcpp.vector field is referenced before the struct's definition
  
  Related discussion at https://forum.dlang.org/thread/efjydhujahujqjrvmnsk@forum.dlang.org

https://github.com/dlang/druntime/pull/3315