D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15983 - [REG 2.071] Symbol visibility in derived classes
Summary: [REG 2.071] Symbol visibility in derived classes
Status: RESOLVED DUPLICATE of issue 15897
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: Martin Nowak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-02 09:43 UTC by Rene Zwanenburg
Modified: 2016-09-12 03:36 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 Rene Zwanenburg 2016-05-02 09:43:40 UTC
This is probably the same issue as 15897, only no circular imports are involved:

---
module a;

class Base
{
  private alias Something = int;
}

void foo(T : Base)(T t)
{
  T.Something something;
}

---
module b;
import a;

class Derived : Base {}

void main()
{
  foo(new Derived());
}
---

This fails to compile with the message
a.d(10): Error: no property 'Something' for type 'b.Derived'.

In this case the fix is easy enough: just use Base.Something in foo(). But my actual code involves a templated base class and template mixin which make that unfeasible.
Comment 1 Martin Nowak 2016-09-12 03:36:35 UTC
You can get the base class like so.

void foo(T)(T t) if (is(T Base == super))
{
    Base.Something something;
}

Still need to have all base classes in a the same module/package as the function.
Would be interested to know, why you rely on duck typing of the base class.
Also maybe it's not worth to hide Something when it's a common property of your class hierarchy.

*** This issue has been marked as a duplicate of issue 15897 ***