[Bug c++/126970] function wrongly regarded immediate-escalating

"mpolacek at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126970

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-21
             Blocks|                            |123615
           Keywords|                            |accepts-invalid, c++26
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This should probably work:

--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -503,9 +503,9 @@ immediate_escalating_function_p (tree fn)
     specifier  */
   if (LAMBDA_FUNCTION_P (fn))
     return true;
-  /* -- a defaulted function that is not declared with the
+  /* -- a non-user-provided defaulted function that is not declared with the
    consteval specifier  */
-  if (DECL_DEFAULTED_FN (fn))
+  if (DECL_DEFAULTED_FN (fn) && !user_provided_p (fn))
     return true;
   /* -- a function that results from the instantiation of a templated entity
    defined with the constexpr specifier.  */


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123615
[Bug 123615] (c++-reflection) - [meta-bug] reflection issue
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.