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.