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
On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote:
outside an unittest, this compiles fine:
struct A
try making it `static struct` instead
cannot implicitly convert expression "hehe" of type string to A
Why does inside a unittest it doesn't work? the constructor
this(s
On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote:
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 wra
On 6/6/19 1:49 PM, Adam D. Ruppe wrote:
On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote:
outside an unittest, this compiles fine:
struct A
try making it `static struct` instead
cannot implicitly convert expression "hehe" of type string to A
Why does inside a unittest it
On Thursday, 6 June 2019 at 17:49:58 UTC, Adam D. Ruppe wrote:
On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote:
outside an unittest, this compiles fine:
struct A
try making it `static struct` instead
didn't work either
cannot implicitly convert expression "hehe" of t
On Thursday, 6 June 2019 at 21:02:37 UTC, Steven Schveighoffer
wrote:
On 6/6/19 1:49 PM, Adam D. Ruppe wrote:
On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote:
outside an unittest, this compiles fine:
struct A
try making it `static struct` instead
cannot implicitly convert
On Friday, 7 June 2019 at 16:30:34 UTC, Machine Code wrote:
On Thursday, 6 June 2019 at 21:02:37 UTC, Steven Schveighoffer
wrote:
[...]
Intesting, I also tried to declare it inside a function, that
did not work either. Is this hidden context pointer a current
limitation in CTFE? I've tried t
On Friday, 7 June 2019 at 16:33:13 UTC, Machine Code wrote:
All this effort is because I do not want unittest code in a
release or even debug.
Well, that part is easy:
version(unittest)
struct Foo {}
at any scope is only build when unittests are turned on in this
build.
On Friday, 7 June 2019 at 16:41:12 UTC, Adam D. Ruppe wrote:
On Friday, 7 June 2019 at 16:33:13 UTC, Machine Code wrote:
All this effort is because I do not want unittest code in a
release or even debug.
Well, that part is easy:
version(unittest)
struct Foo {}
at any scope is only build when