Error: cannot take address
o3o opened this issue · comments
o3o commented
I've come across an unusual error when using Ninja generated by Reggae:
> ninja -C build it master ◼
ninja: Entering directory `build'
[8/12] Compiling .reggae/objs/it.objs/property/source/unit_threaded_property_benchmark_gen_package.a
FAILED: .reggae/objs/it.objs/property/source/unit_threaded_property_benchmark_gen_package.a
/usr/bin/dmd -makedeps=.reggae/objs/it.objs/property/source/unit_threaded_property_benchmark_gen_package.a.dep -lib -debug -g -w -version=Have_unit_threaded_property -version=Have_unit_threaded_exception -version=Have_unit_threaded_from -unittest -I/home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/ -I/home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/exception/source/ -I/home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/from/source/ -of.reggae/objs/it.objs/property/source/unit_threaded_property_benchmark_gen_package.a -color=on -c /home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/unit_threaded/property.d /home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/unit_threaded/randomized/benchmark.d /home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/unit_threaded/randomized/gen.d /home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/unit_threaded/randomized/package.d /home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/unit_threaded/randomized/random.d
/home/dao/.dub/packages/unit-threaded/2.1.7/unit-threaded/subpackages/property/source/unit_threaded/randomized/random.d(77): Error: cannot take address of local `random` in `@safe` function `__unittest_L73_C7`
[11/12] Compiling .reggae/objs/it.objs/runner/source/unit_threaded/runner_attrs_factory_io_options.a
ninja: build stopped: subcommand failed.
I'm not entirely sure which component is causing the issue.
You can find the project demonstrating the error here.
Thank you very much
Atila Neves commented
The issue here is adding -unittest
to integration configuration. If you do that and use unit-threaded you're going to have to also add dip1000.
o3o commented
thank you very much for your support.
So if I remove unittest
:
7 │ alias it = dubConfigurationTarget!(
8 │ Configuration("integration"),
9 │ CompilationMode.options,
11 │ );
```
no test:
```
> ./build/it -l
Listing tests:
```
In this configuration:
```
7 │ alias it = dubConfigurationTarget!(
8 │ Configuration("integration"),
9 │ CompilationMode.options,
10 | CompilerFlags("-unittest", "-dip1000"),
11 │ );
```
it works! thank you again