q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=22094b6a275032027f3a3ef84d36ad4ab4c708a2

commit 22094b6a275032027f3a3ef84d36ad4ab4c708a2
Author: Vitor Sousa <vitorsousasi...@gmail.com>
Date:   Thu Jun 25 15:58:43 2015 +0100

    eolian_cxx: Fix C++ generated inheritance wrappers
    
    Summary:
    Fix a bug that happens when a Eolian C++ wrapper have no default
    constructor (because it have obligatory constructing methods) and it is
    being used as a return of a inheritance wrappers.
    Switched to a conversion of the native type as the default return, instead
    of a value initialized wrapper.
    
    Reviewers: q66, felipealmeida
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2769
---
 src/lib/eolian_cxx/grammar/inheritance_base_generator.hh | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh 
b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
index ed993f0..a3918a9 100644
--- a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
+++ b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
@@ -129,26 +129,24 @@ operator<<(std::ostream& out, inheritance_wrappers const& 
x)
             << ")" << endl
             << "{" << endl;
 
-        if (!function_is_void(func))
-          out << tab(1) << reinterpret_type(func.ret) << " _tmp_ret{};" << 
endl;
-
         out << tab(1)
             << "try" << endl
             << tab(2) << "{" << endl
             << tab(3)
-            << (!function_is_void(func) ? "_tmp_ret = ": "")
+            << (!function_is_void(func) ? "return ": "")
             << "static_cast<T*>(self->this_)->"
             << func.name << "(" << parameters_cxx_list(func.params) << ");" << 
endl
             << tab(2) << "}" << endl
             << tab(1) << "catch (...)" << endl
             << tab(2) << "{" << endl
-            << tab(3) << "eina_error_set( ::efl::eina::unknown_error() );" << 
endl
-            << tab(2) << "}" << endl;
+            << tab(3) << "eina_error_set( ::efl::eina::unknown_error() );" << 
endl;
 
         if (!function_is_void(func))
-          out << tab(1) << "return _tmp_ret;" << endl;
+          out << tab(3) << func.ret.front().native << " _tmp_ret{};" << endl
+              << tab(3) << "return " << to_cxx(func.ret, "_tmp_ret") << ";" << 
endl;
 
-        out << "}" << endl;
+        out << tab(2) << "}" << endl
+            << "}" << endl;
 
         out << scope_guard_tail(x._cls, func) << endl;
      }

-- 


Reply via email to