• Kenton Varda's avatar
    Work around Clang and GCC disagreeing on name mangling. · bcd9e553
    Kenton Varda authored
    Specifically, consider:
    
        capnp::BuilderFor<capnp::DynamicStruct> capnp::Orphan<capnp::AnyPointer>::getAs<capnp::DynamicStruct>(capnp::StructSchema)
    
    Note that `BuilderFor` is a "template using" directive which expands into something more complicated.
    
    GCC mangles the symbol as:
    
        _ZN5capnp6OrphanINS_10AnyPointerEE5getAsINS_13DynamicStructEEENS_11BuilderFor_IT_Xcl4kindIS6_EEEE4TypeENS_12StructSchemaE
    
    Which `c++filt` decodes as:
    
        capnp::BuilderFor_<capnp::DynamicStruct, (kind<capnp::DynamicStruct>)()>::Type capnp::Orphan<capnp::AnyPointer>::getAs<capnp::DynamicStruct>(capnp::StructSchema)
    
    Note that `BuilderFor_<...>::Type` here ends up being a typedef for `DynamicStruct::Builder`. It seems weird to me that the symbol name would not substitute this typedef.
    
    Clang, meanwhile, mangles the symbol as:
    
        _ZN5capnp6OrphanINS_10AnyPointerEE5getAsINS_13DynamicStructEEENS_11BuilderFor_IT_Xclgssr5capnpE4kindIS6_EEEE4TypeENS_12StructSchemaE
    
    Which `c++filt` does not seem to be able to demangle at all. But, it looks like `capnp::kind` is in there, suggesting that, again, the typedef wasn't substituted.
    
    I don't know who is right, but if we inline the whole thing, the problem goes away.
    bcd9e553
Name
Last commit
Last update
..
benchmark Loading commit data...
capnp Loading commit data...
kj Loading commit data...
CMakeLists.txt Loading commit data...