JuliaInterop / Cxx.jl

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

empty fieldname in `show` -- `auto &r = __juliavar1.[missingfieldname]` #418

Open goretkin opened 5 years ago

goretkin commented 5 years ago

I am trying to print this class: https://github.com/bulletphysics/bullet3/blob/master/src/LinearMath/btVector3.cpp

but I receive this error

:3:35: error: expected unqualified-id
            auto &r = __juliavar1.;

(repeated 3 times..?)

Indeed, the generated function at https://github.com/JuliaInterop/Cxx.jl/blob/2b78fd38ea1dca3ce1ae065cbbf691673e964a16/src/show.jl#L8 generates

begin
    print(io, "(", "class btVector3 &", ") ")
    println(io, "{")
    begin
        print(io, " .", "", " = ")
        #= none:7 =#
        show(io, @icxx_str("\n            auto &r = \$x.;\n            return r;\n        "))
        #= none:7 =#
        println(io)
    end
    println(io, "}")
end

I have tried to package a MWE here: https://github.com/goretkin/CxxBulletPrintMWE/blob/master/src/CxxBulletPrintMWE.jl

salexan2001 commented 4 years ago

I am experiencing the same problem. This is probably similar to: https://github.com/JuliaInterop/Cxx.jl/issues/438