On 5/13/22 3:39 PM, zoujiaqing wrote:
```bash
% git clone https://github.com/kerisy/archttp.git
% cd archttp/
% dub build --compiler=dmd
Performing "debug" build using dmd for x86_64.
archttp 0.0.1+commit.3.g70d44ef: building configuration "library"...
../../.dub/packages/nbuff-0.1.14/nbuff/source/nbuff/buffer.d(74,25): Deprecation: `catch` statement without an exception specification is deprecated ../../.dub/packages/nbuff-0.1.14/nbuff/source/nbuff/buffer.d(74,25): use `catch(Throwable)` for old behavior
SSE: false
/opt/dmd/osx/bin/../../src/phobos/std/stdio.d(5190,5): Error: variable `impl` cannot be modified at compile time /opt/dmd/osx/bin/../../src/phobos/std/stdio.d(4130,12): called from here: `makeGlobal()` /opt/dmd/osx/bin/../../src/phobos/std/stdio.d(4220,18): called from here: `trustedStdout()`
```

Why can't we use writeln in constructors?
Comment out writeln so that the code will compile properly!

What writeln? Your compile trace is missing the original call line, and I would say probably more.

From what you are saying, it appears that you are calling writeln inside a constructor, and you are attempting to build an instance of the object at compile time.

Instead of commenting out the writeln, maybe gate it with `if(!__ctfe)`.

-Steve

Reply via email to