digitalmars.D.bugs - [Issue 12540] New: Algebraic recursive alias declaration when a class contains an Algebraic member that can accept itself
- d-bugmail puremagic.com (47/47) Apr 07 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12540
https://d.puremagic.com/issues/show_bug.cgi?id=12540 Summary: Algebraic recursive alias declaration when a class contains an Algebraic member that can accept itself Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: tcdknutson gmail.com PDT --- It's not possible to create an Algebraic alias which can take a class, where that class has the same algebraic type as a member. Example code: ``` import std.variant; alias SomeAlg = Algebraic!SomeClass; class SomeClass { SomeAlg entity; } void main() {} ``` Yielding the error: ``` /d519/f212.d(3): Error: alias f212.SomeAlg recursive alias declaration /opt/compilers/dmd2/include/std/variant.d(1227): Error: template instance std.variant.maxSize!(SomeClass) error instantiating /d519/f212.d(3): instantiated from here: Algebraic!(SomeClass) /d519/f212.d(3): Error: template instance std.variant.Algebraic!(SomeClass) error instantiating ``` What's perhaps stranger is that this code does work: ``` import std.variant; //alias SomeAlg = Algebraic!SomeClass; class SomeClass { Algebraic!SomeClass entity; } void main() {} ``` But it's doing, as far as I can tell, the exact same thing. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 07 2014