Cxx.jl
Cxx.jl copied to clipboard
ERROR: Unhandled template argument kind when displaying tuple
It looks like something is wrong when displaying tuples. I can use a tuple and outputting the tuple to the screen just fine...
julia> cxx" auto tup = std::make_tuple( 1, 2.3f ); ";
julia> icxx" std::cout << std::get<0>(tup) << ' ' << std::get<float>(tup) << std::endl; "
1 2.3
(class std::basic_ostream<char> &) {
}
but I cannot print this tuple
julia> icxx" tup; "
ERROR: Unhandled template argument kind (8)
in error(::ASCIIString) at ./error.jl:21
[inlined code] from ./strings/io.jl:53
in getTemplateParameters(::Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{symbol("clang::CXXRecordDecl")},(false,false,false)},(false,false,false)}, ::Bool, ::Dict{Int64,Void}) at /home/janders/.julia/v0.5/Cxx/src/typetranslation.jl:424
in getTemplateParameters(::Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{symbol("clang::CXXRecordDecl")},(false,false,false)},(false,false,false)}) at /home/janders/.julia/v0.5/Cxx/src/typetranslation.jl:404
in toBaseType(::Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{symbol("clang::Type")},(false,false,false)},(false,false,false)}) at /home/janders/.julia/v0.5/Cxx/src/typetranslation.jl:467
in #juliatype#10(::Bool, ::Bool, ::Any, ::Cxx.QualType, ::Bool, ::Dict{Int64,Void}) at /home/janders/.julia/v0.5/Cxx/src/typetranslation.jl:626
[inlined code] from /home/janders/.julia/v0.5/Cxx/src/typetranslation.jl:486
in #EmitExpr#21(::Array{Any,1}, ::Any, ::Cxx.ClangCompiler, ::Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{symbol("clang::Expr")},(false,false,false)},(false,false,false)}, ::Ptr{Void}, ::Ptr{Void}, ::Tuple{}, ::Array{Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{symbol("clang::ParmVarDecl")},(false,false,false)},(false,false,false)},1}, ::Type{T}) at /home/janders/.julia/v0.5/Cxx/src/codegen.jl:694
[inlined code] from /home/janders/.julia/v0.5/Cxx/src/codegen.jl:680
in #CallDNE#30(::Array{Any,1}, ::Any, ::Cxx.ClangCompiler, ::Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{symbol("clang::Expr")},(false,false,false)},(false,false,false)}, ::Tuple{}) at /home/janders/.julia/v0.5/Cxx/src/cxxstr.jl:329
in (::Vararg{Any})() at /home/janders/.julia/v0.5/Cxx/src/cxxstr.jl:347
in eval(::Module, ::Any) at ./boot.jl:236
I did all of this with a clean install as of today.
julia> versioninfo()
Julia Version 0.5.0-dev+3630
Commit b0e098a* (2016-04-19 15:51 UTC)
Platform Info:
System: Linux (x86_64-redhat-linux)
CPU: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, has well)
shell> git --git-dir $(Pkg.dir("Cxx"))/.git log | head -n5
commit 423d56f1ce65806b300c36088ddcb7ccdd5027f5
Author: Keno Fischer <...>
Date: Mon Apr 18 02:08:47 2016 -0400
Replace feature detect by version check. Fixes #250
Sorry this is taking me a while to figure out. I'm working to understand the clang codebase and whats going on in typetranslation.jl
. I've learned that kind (8)
is a Pack
kind which makes sense since it was a tuple and that for this kind the arguments are stored in the Args struct and that there is pack_iterator
I've also read the llvm print method and I think i understand the gist of what its trying to do. Now i need to understand more about what Cxx.jl
is up to.
The more of this code I read, the more impressed with what @Keno has accomplished here. Thanks!
The problem here isn't just in printing but in the actual type translation. I haven't looked at pack templates, so I'm not really sure what the correct julia representation should be.