Issue 176: Compilation error when using optional String parameter in interface method.
Status:  Fixed
Owner: ----
Closed:  May 2012
Reported by PavelBu...@gmail.com, May 17, 2012
What steps will reproduce the problem?
1.Create interface with one method with at least one optional parameter of type String (IDemo.hx). 
2.Create class that implements this interface (Demo.hx).
3.Try to compile it for cpp target.

What is the expected output? What do you see instead?
Successfull compilation expected, but error occurs:
c:\downloads\TEST\build\cpp\include\IDemo.h(33) : error C2664: 'Demo_obj::test'
: cannot convert parameter 1 from 'hx::Null<T>' to 'String'
        with
        [
            T=String
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
        c:\downloads\TEST\build\cpp\include\IDemo.h(33) : while compiling class template member function 'Void Demo_delegate_<IMPL>::test(hx::Null<T>)'
        with
        [
            IMPL=Demo_obj,
            T=String
        ]
        c:\downloads\TEST\build\cpp\include\Demo.h(31) : see reference to class template instantiation 'IDemo_delegate_<IMPL>' being compiled
        with
        [
            IMPL=Demo_obj
        ]

What version of the product are you using? On what operating system?
hxcpp 2.09, haxe 2.09, Windows XP/OS X

Please provide any additional information below.

TEST.TAR
4.5 KB   Download
May 18, 2012
#1 PavelBu...@gmail.com
This bug reproduces also with Ubuntu, where error looks like:

In file included from include/Demo.h:8:0,
                 from ./src/Demo.cpp:4:
include/IDemo.h: In member function ‘Void IDemo_delegate_<IMPL>::test(hx::Null<String>) [with IMPL = Demo_obj, Void = null]’:
./src/Demo.cpp:109:1:   instantiated from here
include/IDemo.h:33:3: error: no matching function for call to ‘Demo_obj::test(hx::Null<String>&)’
include/IDemo.h:33:3: note: candidate is:
./src/Demo.cpp:36:6: note: virtual Void Demo_obj::test(String)
./src/Demo.cpp:36:6: note:   no known conversion for argument 1 from ‘hx::Null<String>’ to ‘String’

May 22, 2012
Project Member #2 gameh...@gmail.com
Hi,
This has been fixed by this fix:
https://code.google.com/p/hxcpp/issues/detail?id=168
Status: Fixed