Browse Source

cppparser: fix class with array member not seen as copy-constructible

rdb 7 years ago
parent
commit
fa6d8b4b39
2 changed files with 16 additions and 1 deletions
  1. 15 1
      dtool/src/cppparser/cppArrayType.cxx
  2. 1 0
      dtool/src/cppparser/cppArrayType.h

+ 15 - 1
dtool/src/cppparser/cppArrayType.cxx

@@ -93,7 +93,21 @@ is_default_constructible() const {
  */
 bool CPPArrayType::
 is_copy_constructible() const {
-  return false;
+  // This is technically not exactly true, but array data members do not
+  // prevent C++ implicit copy constructor generation rules, so we need to
+  // return true here.
+  // If this is a problem, we will need to create a separate method for the
+  // purpose of checking copyability as a data member.
+  return true;
+}
+
+/**
+ * Returns true if the type is copy-assignable.
+ */
+bool CPPArrayType::
+is_copy_assignable() const {
+  // Same story as is_copy_constructible.
+  return true;
 }
 
 /**

+ 1 - 0
dtool/src/cppparser/cppArrayType.h

@@ -42,6 +42,7 @@ public:
   virtual bool is_trivial() const;
   virtual bool is_default_constructible() const;
   virtual bool is_copy_constructible() const;
+  virtual bool is_copy_assignable() const;
   virtual bool is_equivalent(const CPPType &other) const;
 
   virtual void output(std::ostream &out, int indent_level, CPPScope *scope,