Hi Everyone,
We’re trying to integrate the CERN ROOT framework with Julia, both
of which use LLVM/Clang for C++ interoperability. As such, we’re hoping
to harmonize the versions of clang used in both projects. One major
obstacle to this currently is a patch that the ROOT folks are carrying
to support their I/O system which uses the structure of C++ classes to
determine the on-disk format. The patch as is isn’t really in a form
that could be submitted upstream, but we’re hoping to solicit some advice
to come up with a solution that would be acceptable to clang, and not
require any local code patches.
With that in mind, let us describe the problem:
As mentioned, ROOT uses the structure of C++ classes to determine it’s
IO format. The one wrinkle to that is that sometimes the I/O storage
format and the in-memory format are not exactly the same. In particular,
ROOT has a
typedef double Double32_t;
where if this typedef appears in a struct that is serialized to disk,
it indicates that it should be stored with 32bit precision on disk, but
with 64bit precision in memory.
That’s only for I/O information; for anything regarding symbols we
need these two to share their instantiation data.
I.e. we want to distinguish the types of D::m and
D<Double32_t>::m (and also D<vector<Double32_t>>::m and D<vector>::m) in
template
struct D {
using type = std::remove_reference;
T m;
static int s;
};
But &D::s must the the same as D<Double32_t>::s; more importantly:
void f(D);
must be called by f(D<Double32_t>{}). That is (IIRC) in contrast of what
the C++ committee discussed for strong typedefs.