[Issue 18263] New: selective import with same name masks out this reference in mixin template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 18 12:50:17 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18263
Issue ID: 18263
Summary: selective import with same name masks out this
reference in mixin template
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
The following code fails with an error:
mixin template HappyFunTime()
{
static void foo()
{
import std.meta : Filter;
alias bar = this.bar;
}
}
struct Filter
{
void bar() { }
mixin HappyFunTime;
}
test.d(9): Error: identifier 'bar' of 'Filter.bar' is not defined
What happens is that because both Filter and std.meta.Filter have the same
name, the import for std.meta.Filter somehow masks out the struct Filter for
the "this" lookup in the alias.
This is horrifying. If this lookup absolutely has to be done by name, it should
at least be done by fqn.
--
More information about the Digitalmars-d-bugs
mailing list