D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16061 - [Reg 2.071.1-b1] dot template instance of imported template fails as overloadset
Summary: [Reg 2.071.1-b1] dot template instance of imported template fails as overloadset
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: Martin Nowak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-23 01:29 UTC by Puneet Goel
Modified: 2016-09-13 04:50 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 Puneet Goel 2016-05-23 01:29:33 UTC
$ dmd -c foo.d

Fails with 2.071.1-b1 with error:
bar.d(3): Error: T.Zoo is not a template, it is a overloadset
bar.d(8): Error: template instance bar.Boo!(Foo) error instantiating
foo.d(3): Error: mixin foo.Foo.Bar!() error instantiating


// file foo.d
class Foo {
  import bar;
  mixin Bar;
}

// file bar.d
class Zoo(V) {}
template Boo(T) {
  alias Boo = T.Zoo!T;
}
mixin template Bar() {
  class Zoo(V) {}
  alias U = typeof(this);
  alias BooThis = Boo!U;
}
Comment 1 Martin Nowak 2016-09-13 04:50:38 UTC
The behavior is correct and intended. Also matches pre-2.071.0 behavior.
It's an overloadset of import bar.Zoo and mixin Bar!().Zoo.
The 2-phase lookup for local vs. imported symbols is only done for unqualified lookups, but T.Zoo!T is qualified so it also finds the imported template.

This was wrongly implemented in 2.071.1-b1 (only searched locals), but got fixed here https://github.com/dlang/dmd/pull/5651/files#diff-ddbaa5e9ca3d5c90a425a9dfafaf1734R1123, by not enforcing SearchLocalsOnly if no flags was provided.