Re: [Vala] Invalid C code in Interfaces



Hi,
                      في ح، 03-10-2010 عند 19:30 -0400 ، كتب tecywiz121:
Hello again!

I seem to have run into a case where valac generates incorrect C code.
I'm sure what I am doing is wrong, but I assume that valac should emit
the error and not gcc.
Definitely, the rule of thumb is : if valac generates invalid C code
it's a bug, either in valac or (more likely) in the bindings.

When I try to compile this snippet,

public interface IFace<G> : Object
{
  public G[] foobar()
  {
    G[] storage = new G[2];
    return storage[0:1];
  }
}

void main(){}

I get this error from gcc:

In function ‘iface_foobar’:
generic.vala.c:54: error: dereferencing pointer to incomplete type

The relevant C code is:

The problem is in self->priv->g_dup_func, interfaces cannot have fields,
but the codegen is assuming otherwise. If you make your interface an
abstract class, it works.  Maybe this should be replaced with a property
access (using g_object_get) at least in interfaces.

HTH,
Abderrahim




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