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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot 
gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #2)
> (In reply to Marek Polacek from comment #1)
> > We call mark_used on builtin_pack_fn_p outside a template and it then
> > complains:
> > 
> >   if (builtin_pack_fn_p (decl))
> >     {    
> >       error ("use of built-in parameter pack %qD outside of a template",
> >              DECL_NAME (decl));
> >       return false;
> >     }
> > 
> > I don't know that we need resolve_type_of_reflected_decl for any built-ins. 
> > Maybe we can skip all fndecl_built_in_p?
> Yeah, I think we only need it for VAR_OR_FUNCTION_DECL_P. But also mark_used
> shouldn't be emitting this error unless tf_error is set, we're calling
> mark_used with complain=tf_none.

Sure, missing (complain & tf_error).

FWIW, this didn't find any problems:

--- a/gcc/cp/reflect.cc
+++ b/gcc/cp/reflect.cc
@@ -80,6 +80,15 @@ init_reflection ()
 static void
 resolve_type_of_reflected_decl (tree decl)
 {
+  if (TREE_CODE (decl) == FUNCTION_DECL && fndecl_built_in_p (decl))
+    {
+      gcc_assert (!undeduced_auto_decl (decl));
+      if (tree sp = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (decl)))
+   gcc_assert (TREE_CODE (sp) != DEFERRED_NOEXCEPT
+           && TREE_CODE (sp) != DEFERRED_PARSE);
+      return;
+    }
+
   /* Quietly calling mark_used in an unevaluated context will perform
      all necessary checks and instantiations while suppressing constraint
      unsatisfaction and deletedness diagnostics.  */

Reply via email to