Hi,
I'm currently trying to implement the C++09 exception propagation
proposal (N2179). See the thread at
http://gcc.gnu.org/ml/libstdc++/2008-05/msg00079.html
in the libstdc++ list for details.
As I say in my first follow-up, I need a copy constructor for any type
with a consistent signature. In other words, I need a function like this:
template <typename T>
void copy_constructor(T *dest, const T *src)
{
new (dest) T(*src);
}
Then I can generate the equivalent of
void (*copy)(void*, const void*) = reinterpret_cast<void (*)(void*,
const void*)>(
©_constructor<actual_type>);
to get a function that can copy-construct an arbitrary type (given that
I know the type, which I do).
The problem is that, since this stuff is done in the tree building in
except.c, I can't rely on any header having been included and defining
such a function.
How can I generate this function in code? I need one instantiation per
type that is thrown, and it would be nice to avoid defining the function
anew for every throw expression. I tried finding an existing case of
this in the source, but I can't think of any place where such a thing
would be done, except perhaps generation of an implicit special member.
But I can't find those.
Sebastian