This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82336] [6/7/8 Regression] GCC requires but does not emit defaulted constructors in certain cases


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|mukesh.kapoor at oracle dot com    |paolo.carlini at oracle dot com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Just to confirm that Nathan's analysis is correct the below "works".

That said, I don't know how pervasive the problem is, to wit in how many cases
using perform_implicit_conversion_flags - which is supposed to be used only
when we are committed to do the conversion - in check_default_argument actually
causes problems, if we could imagine restricting an unsharing to some kinds of
arguments (in this case it's an *empty* CONSTRUCTOR!), or we really should
write new facilities only for checking purposes, and so on.

Maybe Jason is willing to comment on this, which kind of ways forward he can
see...

------------

Index: decl.c
===================================================================
--- decl.c      (revision 258222)
+++ decl.c      (working copy)
@@ -12627,6 +12627,8 @@ check_default_argument (tree decl, tree arg, tsubs
        further.  */
     return error_mark_node;

+  tree orig_arg = unshare_expr (arg);
+
   /* [dcl.fct.default]

      A default argument expression is implicitly converted to the
@@ -12636,6 +12638,8 @@ check_default_argument (tree decl, tree arg, tsubs
                                     LOOKUP_IMPLICIT);
   --cp_unevaluated_operand;

+  arg = orig_arg;
+
   /* Avoid redundant -Wzero-as-null-pointer-constant warnings at
      the call sites.  */
   if (TYPE_PTR_OR_PTRMEM_P (decl_type)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]