JuliaInterop / Cxx.jl

The Julia C++ Interface
Other
757 stars 108 forks source link

`@cxx 1 / 2` segfaults #445

Open goretkin opened 4 years ago

goretkin commented 4 years ago

this is on current master:

julia> @cxx 1 / 2

signal (11): Segmentation fault: 11
in expression starting at REPL[5]:1
_ZN5clang7CodeGen15CodeGenFunction12EmitCallExprEPKNS_8CallExprENS0_15ReturnValueSlotE at /Users/goretkin/.julia/dev/Cxx/deps/usr/lib/libcxxffi.dylib (unknown line)
emitcallexpr at /Users/goretkin/.julia/dev/Cxx/deps/usr/lib/libcxxffi.dylib (unknown line)

(so does @cxx 1 + 1, but integer division helps be sure whether the division is happening in C++ or in Julia)

icxx works, and indeed evaluating an expression in the C++ global scope probably doesn't make sense, but I bet it's a common thing to try.

julia> icxx"1 / 2;"
0