Bug #11962
closedRuby 2.3.0 causing compile failure on extensions using a C++ compiler
Description
Hello,
I'm a contributor with the SciRuby foundation, and we have a gem called nmatrix, which is a ruby gem for linear algebra processing in Ruby.
For representing different types of data, nmatrix makes heavy use of C++ templates, which requires compilation with g++. Currently we wrap the code that defines ruby functions at C level in an extern "C" {}
block in a .cpp file and use g++ to compile the file as a whole.
Upgrading to ruby 2.3.0 has caused a problem because of this change implemented in the internals of the ruby C API.
As specified in the GCC docs (https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html) the function "__builtin_choose_expr" (that has been introduced in the latest Ruby C API) is available only for C. Thus the change is rendering our C++ extensions useless.
You can see the compile error being caused in nmatrix here: https://github.com/SciRuby/nmatrix/issues/429
I have come up with a temporary fix for this, but its only patch work and will need to be done by every single extension employing a C++ compiler.
Looking forward to a positive response from you.