D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7966 - First template instantiation inside `with` results in `Error 42: Symbol Undefined`
Summary: First template instantiation inside `with` results in `Error 42: Symbol Undef...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: link-failure, pull
Depends on:
Blocks:
 
Reported: 2012-04-22 09:11 UTC by Denis Shelomovskii
Modified: 2013-11-30 09:10 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 Denis Shelomovskii 2012-04-22 09:11:58 UTC
---
enum E { i }

struct S {
    bool opCast(T)() { return true; }
}

void main() {
    // Error 42: Symbol Undefined bool main.Param.opCast!(bool).opCast()
    with(E) assert(S());
    assert(S());
}
---
Comment 1 Denis Shelomovskii 2013-11-26 23:22:38 UTC
The bug is present in 5f033bfd9f7aaf95dade128f50bfc7360bb16215.
Comment 3 github-bugzilla 2013-11-30 08:16:12 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f8ec8ee7d447c966f8a064a1313b936f6d2adba8
fix Issue 7966 - First template instantiation inside `with` results in `Error 42: Symbol Undefined`

Always use `WithScopeSymbol` to make correct chain of `scopesym->parent`.

https://github.com/D-Programming-Language/dmd/commit/e0b6a37a6e820d641c3edbf4a467392b8c6adac3
Merge pull request #2890 from 9rnsr/fix7966

Issue 7966 - First template instantiation inside `with` results in `Error 42: Symbol Undefined`