Re: [Vala] Fwd: Delegate with out parameters are not working within lambdas



http://bugzilla.gnome.org/show_bug.cgi?id=574403

The patch still applies to Vala 0.7.2; definitely won't apply to the master branch.


Yu
On Sun, May 17, 2009 at 6:03 AM, Mike Massonnet <mmassonnet gmail com> wrote:
Hi,

When using this code:

|public delegate void SampleFunc (int a, out int x);
|
|void f1 (int a, out int x) {
|       print ("a %d\n", a);
|       x = a * 10;
|}
|
|void f2 (SampleFunc func, int a) {
|       int x;
|       func (a, out x);
|       print ("x %d\n", x);
|}
|
|static int main (string[] args) {
|       /* Passing a function */
|       f2 (f1, 5);
|       /* Using a lambda */
|       f2 ( (a, x) => {
|               print ("lambda a %d\n", a);
|               x = a * 10;
|               }, 5);
|       return 0;
|}

the lamdba function isn't working because instead of passing gint *x
it passes gint x. Here is the error message:

|/tmp/lambda-out-parameters.vala.c: In function ‘__lambda0__sample_func’:
|/tmp/lambda-out-parameters.vala.c:46: attention : passing argument 2
of ‘_lambda0_’ makes integer from pointer without a cast
|/tmp/lambda-out-parameters.vala.c:39: note: expected ‘gint’ but
argument is of type ‘gint *’

This is with Vala 0.7.1, I don't have 0.7.2 yet as I isntall from
packages. Should I open a bug report?

Cheers
Mike
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]