After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792077 - too few arguments error to delegate returning a delegate
too few arguments error to delegate returning a delegate
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Delegates
0.38.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-12-31 10:03 UTC by kosmolot17
Modified: 2018-01-06 15:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Add destroy out-param when invoking delegate returned by delegate (2.24 KB, patch)
2018-01-06 13:29 UTC, Rico Tzschichholz
committed Details | Review

Description kosmolot17 2017-12-31 10:03:32 UTC
This code doesn't compile:

// delegate returning a function
public delegate Func<G> FuncGenerator<G> ();

void main () {
	FuncGenerator<int> func_generator = () => {
		return (data) => {
			print("hello %d!\n", data);
		};
	};
	Func<int> func = func_generator();
}

--------------------------------------------------

output:

/tmp/test.vala.QBFDCZ.c: In function ‘__lambda4_’:
/tmp/test.vala.QBFDCZ.c:36:9: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  _tmp0_ = ___lambda5__gfunc;
         ^
/tmp/test.vala.QBFDCZ.c: In function ‘_vala_main’:
/tmp/test.vala.QBFDCZ.c:65:11: error: too few arguments to function ‘func_generator’
  _tmp1_ = func_generator (&_tmp0_, func_generator_target);
           ^~~~~~~~~~~~~~
error: cc exited with status 256
Comment 1 Rico Tzschichholz 2018-01-06 13:29:28 UTC
Created attachment 366416 [details] [review]
codegen: Add destroy out-param when invoking delegate returned by delegate
Comment 2 Rico Tzschichholz 2018-01-06 15:05:54 UTC
Attachment 366416 [details] pushed as ecb8a6f - codegen: Add destroy out-param when invoking delegate returned by delegate