D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19973 - Too many template forward reference errors in recursive template
Summary: Too many template forward reference errors in recursive template
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2019-06-16 09:46 UTC by Iain Buclaw
Modified: 2024-12-13 19:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2019-06-16 09:46:10 UTC
auto a(int b = a) {}
auto a(int b) {}


The error when compiling the above is:
---
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
a.d(1): Error: forward reference to template a
---

Which is about 18 errors too many.

Reverse the declarations, and the error becomes a little more reasonable:
---
a.d(2): Error: forward reference to template a
a.d(2): Error: forward reference to template a
a.d(2): Error: none of the overloads of a are callable using argument types (), candidates are:
a.d(1):        a.a(int b)
a.d(2):        a.a(int b = a)
---
Comment 1 dlangBugzillaToGithub 2024-12-13 19:04:01 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

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

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