On Monday, 3 September 2018 at 15:00:33 UTC, Alex wrote:
On Monday, 3 September 2018 at 14:00:23 UTC, agorkvmh wrote:
[...]
Yes. Put a pragma where you static assert for Foo(1).pos
equality with 2:
[...]
Thanks, by the way, the autocomplete suggests me '__ctfeWrite',
what is it?
On Monday, 3 September 2018 at 13:52:24 UTC, bauss wrote:
On Monday, 3 September 2018 at 13:39:25 UTC, agorkvmh wrote:
[...]
It prints 1, because pragma(msg) is called when the compiler is
analyzing the code through the semantic process and not when
the body of the function is executed
Hi all,
Running this:
---
static assert(Foo(1).pos == 2);
struct Foo
{
this(int i){ advance(); }
size_t pos =1;
void advance()
{
pragma(msg, pos);
pos = pos+1;
pragma(msg, pos);
}
}
dmd -o- -unittest source/pgs/parser.d
1LU
1LU
---
The static