Hi!

As mentioned in the PR, this code is likely only valid in C++23 and
later and not really useful in that case and it might be a GCC bug
that it fails to diagnose the bug in C++14 to C++20 modes (it diagnoses
it in C++11 mode).

In any case, the class doesn't have any constexpr constructors, so
it isn't a literal type, one can't construct those objects in constant
expressions and so using constexpr keyword for the defaulted copy assignment
operator can't help because that needs to copy from a constant expression
which isn't possible to construct.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2025-06-06  Jakub Jelinek  <ja...@redhat.com>

        PR cobol/120554
        * common-defs.h (cbl_declarative_t::operator=): Remove constexpr.

--- libgcobol/common-defs.h.jj  2025-06-04 19:37:23.819423789 +0200
+++ libgcobol/common-defs.h     2025-06-06 11:50:07.873810554 +0200
@@ -512,7 +512,7 @@ struct cbl_declarative_t {
       std::copy( that.files, that.files + nfile, this->files );
     }
   }
-  constexpr cbl_declarative_t& operator=(const cbl_declarative_t&) = default;
+  cbl_declarative_t& operator=(const cbl_declarative_t&) = default;
 
   std::vector<uint64_t> encode() const;
 

        Jakub

Reply via email to