Bug 11166 – Forward reference error when alias of template instance is private

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-03T18:34:00Z
Last change time
2015-06-17T21:01:56Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-10-03T18:34:03Z
This is a weird one: ----- template Tup(T...) { alias Tup = T; } struct S { enum S a = S(0); enum S b = S(1); this(long value) { } long value; // only triggered when private and a template instance. private alias types = Tup!(a, b); } void main() { } ----- test.d(5): Error: cannot create a struct until its size is determined test.d(6): Error: cannot create a struct until its size is determined Note, there is also the following bug where I've accidentally used an enum instead of an alias in the Tuple definition: template Tup(T...) { enum Tup = T; } Using this with the above test-case causes the same diagnostics, but also crashes DMD (git-head). In 2.063.2 it doesn't crash but instead creates an additional diagnostic: test.d(12): Error: template instance bad1.Tup!(__error, __error) error instantiating
Comment #1 by andrej.mitrovich — 2013-10-03T18:42:36Z
(In reply to comment #0) > snip Also: If you remove the ctor it will compile.
Comment #2 by k.hara.pg — 2015-03-06T15:03:20Z
Comment #3 by github-bugzilla — 2015-03-28T20:19:06Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5949d0efb22fd09561d392ce392ce68a385d1044 fix Issue 11166 - Forward reference error when alias of template instance is private
Comment #4 by github-bugzilla — 2015-03-30T06:10:42Z
Comment #5 by github-bugzilla — 2015-06-17T21:01:56Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5949d0efb22fd09561d392ce392ce68a385d1044 fix Issue 11166 - Forward reference error when alias of template instance is private https://github.com/D-Programming-Language/dmd/commit/d7a356e71c7df01b54677d49d532741b2ea792e4 Move issue 11166 test case to compilable/testfwdref.d