Why this fails when using unittest?
Machine Code
jckj33 at gmail.com
Thu Jun 6 17:40:17 UTC 2019
outside an unittest, this compiles fine:
struct A
{
enum A foo = "hehe";
this(string a) { m_a = a; }
alias m_a this;
string m_a;
}
but if you wrap this a unittest {} and compile with
> dmd -unittest -run foo.d
this give the following error:
> cannot implicitly convert expression "hehe" of type string to A
Why does inside a unittest it doesn't work? the constructor
this(string) {} seems to get disabled.
More information about the Digitalmars-d-learn
mailing list