I definitely messed up the fix to a so-called bug about uninitialized bools, but I can’t actually replicate this error anywhere. Do you know what version of g++ is being used and what is in ~/.R/Makevars ?
To be sure, I tried again on my Ubuntu 16.04 server. On each g++, the error is the same, I show one below.
I reverted to 2.5.2, which worked without problems.
StanHeaders is 2.16.0.1
g++ -I/usr/share/R/include -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"`"/usr/lib/R/bin/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppEigen/include" -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/StanHeaders/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c lang__grammars__functions_grammar_inst.cpp -o lang__grammars__functions_grammar_inst.o
In file included from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/lang/ast.hpp:68:0,
from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/lang/grammars/functions_grammar_def.hpp:4,
from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/lang/grammars/functions_grammar_inst.cpp:1,
from lang__grammars__functions_grammar_inst.cpp:18:
/usr/local/lib/R/site-library/StanHeaders/include/src/stan/lang/ast/node/conditional_op.hpp:40:23: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool has_var_ = false;
There is no branch yet. But when there is, CXX_STD = CXX11 will be required so you can go ahead and put it in src/Makevars now. It won’t hurt anything.
CX11 alone in Makevars of my app does not help, since the error turns up when I build rstan on my own server and on TravisCI. So I would have to do my own branch of rstan, which is possible, but messy.
You still get the message non-static data member initializers only available with -std=c++11 or -std=gnu++11 even after you compile under the C++11 standard?
On my desktop: no, that’s Windows anyway, so C11 works.
On TravisCI and Ubuntu Server: Yes, because I have not yet made a fork where I can change Makevars.
walker works fine locally and on Travis with OSX and clang, but rstan installation fails with gcc and on linux in general, where it gives the ISO C++ error regarding has_var_ as above. I have CXX_STD = CXX11 in the Makevars, and modified the make_cpp.R as well.
Good to have it confirmed independently. I checked your log, and it also fails during compile of rstan, not while your package was build. So your job setting of CXX11 is not relevant yet, even if it may be required once your package is created.
/node/conditional_op.hpp:40:23: sorry, unimplemented: non-static data member initializers
/home/travis/R/Library/StanHeaders/include/src/stan/lang/ast/node/conditional_op.hpp:40:23: error: ISO C++ forbids in-class initialization of non-const static member ‘has_var_’
make: *** [lang__ast_def.o] Error 1
ERROR: compilation failed for package ‘rstan’
* removing ‘/home/travis/R/Library/rstan’
It is strange that it compiles as g++ -std=gnu++0x ... i.e. it picks up the USE_CXX11 flag but does not use clang++ to compile. And this version of g++ seems not to have implemented enough of the C++11 standard to avoid the compiler error.