Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many template forward reference errors in recursive template #19586

Open
dlangBugzillaToGithub opened this issue Jun 16, 2019 · 0 comments
Open

Comments

@dlangBugzillaToGithub
Copy link

Iain Buclaw (@ibuclaw) reported this on 2019-06-16T09:46:10Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19973

CC List

Description

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)
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant