On 12/28/18 9:33 PM, Alexandre Oliva wrote:
On Dec 28, 2018, Alexandre Oliva <aol...@redhat.com> wrote:
I guess I still need to
fill in other gaps to in my knowledge to try and make sense of it.
Done.
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
Here's a patch based on your suggestion.
[PR88146] do not instantiate constexpr if not manifestly const
This is another approach at fixing the g++.dg/cpp0x/inh-ctor32.C test
failures on targets that have non-void return values for cdtors: only
instantiate constexpr functions for expressions that are potentially
constant evaluated.
Alas, this exposed a latent problem elsewhere: braced initializer
lists underwent check_narrowing when simplified to non-lists, but that
did not signal maybe_constant_value the potentially constant evaluated
constant that all direct members of braced initializer lists have, so
after the change above we'd no longer initialize constexpr functions
that per P0859 we ought to.
Ah, yeah, that's a troublesome complication. This area of the standard
is very new, so I think let's defer trying to deal with this issue and
pursue your other patch for now.
+ if (TREE_OPERAND (expr, 1)
+ && TREE_CODE (TREE_OPERAND (expr, 1)) == ADDR_EXPR
+ && DECL_P (TREE_OPERAND (TREE_OPERAND (expr, 1), 0))
+ && IDENTIFIER_CDTOR_P (DECL_NAME (TREE_OPERAND (TREE_OPERAND (expr,
1), 0))))
Maybe
if (tree fn = cp_get_callee_fndecl_nofold (expr))
if (DECL_CONSTRUCTOR_P (fn) || DECL_DESTRUCTOR_P (fn))
? The other patch is OK with that change.
Jason