[Bug c++/118190] [12/13/14/15 Regression] ICE: in tsubst_expr, at cp/pt.cc:22244 since r10-1280-g78f7607db4c53f

2025-02-07 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118190

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Marek Polacek  ---
Fixed for 15.

[Bug c++/118190] [12/13/14/15 Regression] ICE: in tsubst_expr, at cp/pt.cc:22244 since r10-1280-g78f7607db4c53f

2025-02-07 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118190

--- Comment #5 from GCC Commits  ---
The trunk branch has been updated by Marek Polacek :

https://gcc.gnu.org/g:f5ef1f9e8589697086c8cfea6ad07d56050dde96

commit r15-7417-gf5ef1f9e8589697086c8cfea6ad07d56050dde96
Author: Marek Polacek 
Date:   Thu Feb 6 08:57:22 2025 -0500

c++: ICE with unparsed noexcept [PR117106]

In a member-specification of a class, a noexcept-specifier is
a complete-class context.  Thus we delay parsing until the end of
the class via our DEFERRED_PARSE mechanism; see cp_parser_save_noexcept
and cp_parser_late_noexcept_specifier.

We also attempt to defer instantiation of noexcept-specifiers in order
to reduce the number of instantiations; this is done via DEFERRED_NOEXCEPT.

We can even have both, as in noexcept65.C: a DEFERRED_PARSE wrapped in
DEFERRED_NOEXCEPT, which uses the DEFPARSE_INSTANTIATIONS mechanism.
noexcept65.C works, because when we really need the noexcept, which is
when parsing the body of S::A::A(), the noexcept will have been parsed
already; noexcepts are parsed before bodies of member function.

But in this test we have:

  struct A {
  int x;
  template
  void foo() noexcept(noexcept(x)) {}
  auto bar() -> decltype(foo()) {} // #1
  };

and I think the decltype in #1 needs the unparsed noexcept before it
could have been parsed.  clang++ rejects the test and I suppose we
should reject it as well, rather than crashing on a DEFERRED_PARSE
in tsubst_expr.

PR c++/117106
PR c++/118190

gcc/cp/ChangeLog:

* pt.cc (maybe_instantiate_noexcept): Give an error if the noexcept
hasn't been parsed yet.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept89.C: New test.
* g++.dg/cpp0x/noexcept90.C: New test.

Reviewed-by: Jason Merrill 

[Bug c++/118190] [12/13/14/15 Regression] ICE: in tsubst_expr, at cp/pt.cc:22244 since r10-1280-g78f7607db4c53f

2025-01-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118190

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2