The following C++ program compiles but segfaults (with clang++-3.6 and g++-5)
#include <stan/math.hpp>
#include <iostream>
#include <complex>
int main() {
stan::math::var x = 1;
std::complex<stan::math::var> z = x;
std::cout << "imaginary part is " << z.imag().val() << std::endl;
return 0;
}
I think we should try to prevent that from compiling, or at least dying gracefully, but failing that I guess we should initialize the imaginary part to zero?
The following C++ program compiles but segfaults (with clang++-3.6 and g++-5)
I think we should try to prevent that from compiling, or at least dying gracefully, but failing that I guess we should initialize the imaginary part to zero?