https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100409
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> --- (In reply to Richard Biener from comment #10) > (In reply to Richard Biener from comment #7) > > Jason, any idea? > > diff --git a/gcc/cp/except.c b/gcc/cp/except.c > index a8cea53cf91..cbc94dff790 100644 > --- a/gcc/cp/except.c > +++ b/gcc/cp/except.c > @@ -1050,7 +1050,7 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees*/, > void * /*data*/) > if (concept_check_p (fn)) > return NULL_TREE; > tree type = TREE_TYPE (fn); > - gcc_assert (INDIRECT_TYPE_P (type)); > + gcc_assert (INDIRECT_TYPE_P (type) || type == unknown_type_node); > type = TREE_TYPE (type); > > STRIP_NOPS (fn); > @@ -1073,7 +1073,7 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees*/, > void * /*data*/) > to evaluate the noexcept-specifier's operand here, but that > could > cause instantiations that would fail. */ > } > - if (!TYPE_NOTHROW_P (type)) > + if (type == unknown_type_node || !TYPE_NOTHROW_P (type)) > return fn; > } > > > fixes all but the ICE for g++.dg/warn/noeffect4.C where we end up with > an invalid CALL_EXPR: > > arg:0 <sizeof_expr 0x7ffff66ce940 type <integer_type 0x7ffff65617e0 > long unsigned int> > readonly > arg:0 <call_expr 0x7ffff6550738 type <integer_type > 0x7ffff65615e8 int> > side-effects tree_6 > fn <component_ref 0x7ffff66cf300 type <method_type > 0x7ffff66a5f18> > > > also notice how sizeof() doesn't have side-effects but the call has. I > suppose that's somehow an "unevaluated" sizeof() expression we don't > expect to hit expr_noexcept_p? OTOH noexcept(sizeof(foo())) might be > "valid"? Incidentally I just posted a patch for noexcept(sizeof(foo())) because we got the result wrong (I hadn't been aware of this PR): bug 101087. Not sure if that is going to help here, but it could.