Re: Cannot implicitly convert expression (struct this)

2017-07-05 Thread Andre Pany via Digitalmars-d-learn
On Friday, 23 June 2017 at 15:52:10 UTC, Kagamin wrote: On Thursday, 22 June 2017 at 09:57:44 UTC, Andre Pany wrote: This line raises the error: TestStruct s2 = TestStruct(Reason.FU); Error: cannot implicitly convert expression ("Fu") of type Reason to InitialEnum!(Reason) While this line is

Re: Cannot implicitly convert expression (struct this)

2017-06-23 Thread Kagamin via Digitalmars-d-learn
On Thursday, 22 June 2017 at 09:57:44 UTC, Andre Pany wrote: This line raises the error: TestStruct s2 = TestStruct(Reason.FU); Error: cannot implicitly convert expression ("Fu") of type Reason to InitialEnum!(Reason) While this line is working fine: TestStruct s1 = {reason: Reason.FU}; I th

Cannot implicitly convert expression (struct this)

2017-06-22 Thread Andre Pany via Digitalmars-d-learn
Hi, I created a custom type which enables me to have enums which have in their initial state, the init value of their base type. Something similiar to Nullable... enum Reason : string {CO = "Co", FU = "Fu", CA = "Ca"} struct TestStruct {InitialEnum!Reason reason;} This line raises the error: