[Bug c++/84968] [8 Regression] ICE in strip_typedefs_expr, at cp/tree.c:1792

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 21 16:45:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84968

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly adjusted testcase, so that it is less invalid.
struct S {
  template <typename>
  void foo ()
  try {} catch (int () noexcept (({ union B a; true; }))) {}
};

With the template <typename> line commented out, we reject it
aggregate ‘S::foo()::B a’ has incomplete type and cannot be defined
If there is union B {}; before struct S, it is accepted both as a template or
as non-template, with union B {} a; true; in template it is error-recovery:
pr84968.C: In member function ‘void S::foo()’:
pr84968.C:4:45: error: types may not be defined in an exception-specification
   try {} catch (int () noexcept (({ union B {} a; true; }))) {}
                                             ^
pr84968.C:4:59: internal compiler error: in strip_typedefs_expr, at
cp/tree.c:1792
   try {} catch (int () noexcept (({ union B {} a; true; }))) {}
                                                           ^

Apparently strip_typedef_exprs isn't prepared to handle STMT_EXPR body, in
particular STATEMENT_LIST.  Is that the way to go?


More information about the Gcc-bugs mailing list