-
-
Notifications
You must be signed in to change notification settings - Fork 748
Open
Labels
Description
I'm working on a function in the phobos library. The function combines two real parameters into an array and passes it into the any template function. The function is not allowed to use the garbage collector. Here's a simplified version of it.
/** docs */
@nogc bool f(real a, real b)
{
return [a, b].any!isNaN;
}Building the library succeeds. However, building the docs fails, saying that the array literal causes a GC allocation. Here's a shortened version of the example build outputs.
prompt> make
../dmd/generated/linux/release/64/dmd -conf= -I../dmd/druntime/import -w -preview=dip1000 -preview=dtorfields -preview=fieldwise -m64 -fPIC -O -release -lib ...
prompt> echo $?
0
prompt> make build-html
/home/tedgin/repos/dlang/dlang.org/.generated/ddoc_preprocessor --compiler=/home/tedgin/repos/dlang/dmd/generated/linux/release/64/dmd -conf= -m64 -w -c -o- -version=StdDdoc ...
------------ Compiler output -----------
/tmp/ddoc_preprocessor_ ... : Error: this array literal causes a GC allocation in `@nogc` function `f`
return [a, b].any!isNaN;
^It looks like -preview=dip1000 is passed to the dmd execution when building the library but isn't passed when building the documentation.
Reactions are currently unavailable