On 11/27/18 11:54 PM, Alexandre Oliva wrote:
On Nov 27, 2018, Jason Merrill <ja...@redhat.com> wrote:

On 11/22/18 6:40 PM, Alexandre Oliva wrote:
Mangling visits the base template function type, prior to template
resolution, and on such types, exception specifications may contain
unresolved noexcept expressions.  nothrow_spec_p is called on them
even when exception specifications are not part of function types, and
it rejects unresolved noexcept expressions if processing_template_decl
is not set.

The problem here is that the noexcept expression is unresolved even
though it isn't dependent

Yeah, but that seems to be on purpose, according to these comments, that
precede the hunk below.

   /* This isn't part of the signature, so don't bother trying to evaluate
      it until instantiation.  */

Taking out the 'flag_noexcept_type && ' subexpr fixes the problem, but
defeats the intended deferral of unnecessary computation:

diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 3449b59b3cc0..dbd233c94c3a 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1193,7 +1193,7 @@ build_noexcept_spec (tree expr, tsubst_flags_t complain)
       it until instantiation.  */
    if (TREE_CODE (expr) != DEFERRED_NOEXCEPT
        && (!processing_template_decl
-         || (flag_noexcept_type && !value_dependent_expression_p (expr))))
+         || !value_dependent_expression_p (expr)))
      {
        expr = perform_implicit_conversion_flags (boolean_type_node, expr,
                                                complain,

Let's go with this.  And remove the comment.

And the !processing_template_decl is also redundant, since that's checked at the top of value_dependent_expression_p.

Jason

Reply via email to