jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=12d50cbe1938a096e8c06674d7b8ee8c33d5c335

commit 12d50cbe1938a096e8c06674d7b8ee8c33d5c335
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Wed Nov 22 19:45:56 2017 +0900

    cxx: No instantiate ctors for non-regular classes
    
    Only regular classes can be instantiated, this should be reflected in
    the C++ binding as well.
---
 src/lib/eolian_cxx/grammar/class_definition.hpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp 
b/src/lib/eolian_cxx/grammar/class_definition.hpp
index d5810da033..a60e18dedf 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -42,8 +42,7 @@ struct class_definition_generator
      if(!as_generator("\n{\n").generate(sink, attributes::unused, context)) 
return false;
 
      // constructors
-     if(!as_generator
-        (
+     if(!as_generator(
             scope_tab << "explicit " << string << "( ::Eo* eo)\n"
          << scope_tab << scope_tab << ": ::efl::eo::concrete(eo) {}\n"
          << scope_tab << string << "(std::nullptr_t)\n"
@@ -57,10 +56,13 @@ struct class_definition_generator
          << scope_tab << string << "(Derived&& derived\n"
          << scope_tab << scope_tab << ", typename std::enable_if<\n"
          << scope_tab << scope_tab << scope_tab << 
"::efl::eo::is_eolian_object<Derived>::value\n"
-         << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << 
string << ", Derived>::value"
-         << scope_tab << scope_tab << scope_tab << ">::type* = 0) : 
::efl::eo::concrete(derived._eo_ptr())\n"
-         << scope_tab << "{}\n"
-         << scope_tab << string << "( ::efl::eo::instantiate_t)\n"
+         << scope_tab << scope_tab << scope_tab << " && std::is_base_of< " << 
string << ", Derived>::value>::type* = 0)\n"
+         << scope_tab << scope_tab << scope_tab << ": 
::efl::eo::concrete(derived._eo_ptr()) {}\n\n"
+              ).generate(sink, attributes::make_infinite_tuple(cls.cxx_name), 
context))
+       return false;
+
+     if((cls.type == attributes::class_type::regular) && !as_generator(
+            scope_tab << string << "( ::efl::eo::instantiate_t)\n"
          << scope_tab << "{\n"
          << scope_tab << scope_tab << "::efl::eolian::do_eo_add( 
::efl::eo::concrete::_eo_raw, ::efl::eo::concrete{nullptr}, _eo_class());\n"
          << scope_tab << "}\n"
@@ -76,7 +78,7 @@ struct class_definition_generator
          << scope_tab << "template <typename T, typename F> " << string << "(  
::efl::eo::instantiate_t, T&& parent, F&& f, typename ::std::enable_if< 
::efl::eolian::is_constructor_lambda<F, " << string << " >::value && 
::efl::eo::is_eolian_object<T>::value>::type* = 0)\n"
          << scope_tab << "{\n"
          << scope_tab << scope_tab << "::efl::eolian::do_eo_add( 
::efl::eo::concrete::_eo_raw, parent, _eo_class(), *this, 
std::forward<F>(f));\n"
-         << scope_tab << "}\n"
+         << scope_tab << "}\n\n"
          // << scope_tab << "explicit " << string << "( ::efl::eo::concrete 
const& parent)\n"
          // << scope_tab << scope_tab << ": ::efl::eo::concrete( 
::efl::eo::do_eo_add(parent)) {}\n"
          // << scope_tab << "template <typename F>\n"

-- 


Reply via email to