On Friday, 4 September 2015 at 17:46:11 UTC, Prudence wrote:
On Friday, 4 September 2015 at 01:00:24 UTC, Mike Parker wrote:
On Thursday, 3 September 2015 at 23:09:18 UTC, Prudence wrote:
\..\..\src\phobos\std\experimental\logger\core.d(1784): Error: static variable stdLoggerThreadLogger cannot be read at compile time

I'm trying to use the logger in a static this. It should work or, if it can't, quietly fail(not log anything)... and not break the program.

The error tells you you're trying to use something in a compile-time context that can't be used at compile time. You *should* get errors in that situation. Can you share the offending code?

Wait, that makes no sense... The error is in phobos... not my code. THAT specifically means that it is a phobos problem, irrespective of what I'm doing.

Is the above the _entire_ error message? For a simple test program, I get the following:

    int sayHello() {
        import std.stdio;
        writeln("Hello!");
        return 42;
    }

    enum value = sayHello();    // line 7


/home/marc/d/phobos/std/stdio.d(3012): Error: static variable stdout cannot be read at compile time /home/marc/d/phobos/std/stdio.d(3076): called from here: trustedStdout()
    xx.d(3):        called from here: writeln("Hello!")
    xx.d(7):        called from here: sayHello()

Notice the lines saying "called from here". They will point you to the place where the compile-time evaluation is started.

Reply via email to