RFA (tree-inline): PATCH for more C++14 constexpr support
Jason Merrill
jason@redhat.com
Sun Nov 16 06:35:00 GMT 2014
This patch implements more support for C++14 constexpr: it allows
arbitrary modification of variables in a constexpr function, but does
not currently handle jumping -- multiple returns, loops, switches.
The approach I took for this was to just use the DECL_SAVED_TREE for a
constexpr function as the basis for expansion rather than trying to
massage it into a magic expression. And now the values of local
variables, including parameters, are kept in the values hash map that I
introduced with the aggregate NSDMI patch.
But in the presence of recursive constexpr calls we can't use the same
PARM_DECL as a key, so we need to remap it. Thus I've added
remap_fn_body to tree-inline.c to unshare the entire function body and
remap the parms and result to avoid clashes.
This handles some more C++14 testcases and has no regressions on C++11
constexpr testcases. Support for jumps will follow soon.
Tested x86_64-pc-linux-gnu and powerpc64-unknown-linux-gnu.
Is the remap_fn_body function ok for trunk?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cx14.patch
Type: text/x-patch
Size: 40338 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141116/393983b4/attachment.bin>
More information about the Gcc-patches
mailing list