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

IFTI undefined identifier confusion #20739

Open
sampotter opened this issue Jan 19, 2025 · 0 comments
Open

IFTI undefined identifier confusion #20739

sampotter opened this issue Jan 19, 2025 · 0 comments

Comments

@sampotter
Copy link

Here's a small sample:

struct A(int M, int N) {}

void f(int M)(A!(M - 1, M) a) {}

void main() {
     A!(1, 2) a;
     f(a);
}

Output from dmd:

test.d(3): Error: undefined identifier `M`
test.d(7): Error: template `f` is not callable using argument types `!()(A!(1, 2))`
test.d(3):        Candidate is: `f(int M)(A!(M - 1, M) a)`

Note the first line of output. It seems like the compiler should be smart enough to understand that every instance of the identifier M is defined on that line.

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

2 participants