* Injecting a function into code generation
@ 2008-05-22 12:38 Sebastian Redl
0 siblings, 0 replies; only message in thread
From: Sebastian Redl @ 2008-05-22 12:38 UTC (permalink / raw)
To: gcc
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-22 12:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22 12:38 Injecting a function into code generation Sebastian Redl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).