D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7888 - derivedMembers forward reference error with nested imports
Summary: derivedMembers forward reference error with nested imports
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-10 19:07 UTC by David Nadlinger
Modified: 2012-04-10 20:27 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 David Nadlinger 2012-04-10 19:07:18 UTC
The different behavior of is() from bug 7868 depending on whether it was invoked from a static if condition or not might be acceptable, but this example is clearly a regression in my eyes:

---
module a;

struct A {
  import b : c;

  // Instantiate template which uses derivedMembers.
  alias D!A Test;

  // Unrelated template from other module - »not defined«.
  static if (c!()()) {}
}

// Just something using derivedMembers.
template D(T) {
  mixin({
    foreach (name; __traits(derivedMembers, T)) {}
    return "";
  }());
}
---
---
module b;
bool c()() { return true; }
---

It compiled fine in DMD 2.058, but fails with »template instance c!() template 'c' is not defined, did you mean a?« in latest Git master (7c22b8a), which is absolutely not related to the cause of the error.
Comment 1 github-bugzilla 2012-04-10 20:27:04 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/747e13608d4f50b6f57ef0bfe134cb62e1b0b7db
fix Issue 7888 - derivedMembers forward reference error with nested imports
Comment 2 github-bugzilla 2012-04-10 20:27:22 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9e13e3918bbec70a42812b791e1d5b90245244da
fix Issue 7888 - derivedMembers forward reference error with nested imports