[Issue 18584] New: Undefined identifier when not specifying 'this'
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 9 14:24:28 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18584
Issue ID: 18584
Summary: Undefined identifier when not specifying 'this'
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: simen.kjaras at gmail.com
This program gives the error message 'undefined identifier n':
struct S {
int n;
auto fun() { return tmp!(a => n)(); }
}
struct tmp(alias fns) {
alias fun = fns!int;
}
If you just add 'this', it works:
struct S {
int n;
auto fun() { return tmp!(a => this.n)(); }
}
struct tmp(alias fns) {
alias fun = fns!int;
}
There should be no ambiguity here as to which 'n' I'm referring to, and 'this'
should be unnecessary.
--
More information about the Digitalmars-d-bugs
mailing list