[Issue 12540] New: Algebraic recursive alias declaration when a class contains an Algebraic member that can accept itself
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 7 12:04:01 PDT 2014
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 at puremagic.com
ReportedBy: tcdknutson at gmail.com
--- Comment #0 from Dylan Knutson <tcdknutson at gmail.com> 2014-04-07 12:03:58 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: -------
More information about the Digitalmars-d-bugs
mailing list