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 675107 - Strange behaviour with libgee-0.8
Strange behaviour with libgee-0.8
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other All
: Normal normal
: 1.0
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-29 23:10 UTC by Abdullah A. Hassan
Modified: 2018-05-22 14:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Abdullah A. Hassan 2012-04-29 23:10:23 UTC
This bit of code:
class MixedArray: Gee.HashMap<string, GLib.Value> {}

Compiles fine in vala, but produces compiler errors from GCC:

$ valac --library=test valatest.vala --pkg gee-0.8
d:/dev/valatest.vala.c: In function 'mixed_array_construct':
d:/dev/valatest.vala.c:45: error: expected expression before ',' token
d:/dev/valatest.vala.c:45: warning: passing argument 7 of 'gee_hash_map_construct' from incompatible pointer type
Compilation failed: 1 error(s), 0 warning(s)
error: cc exited with status 1

I get similar errors from Microsoft's CL compiler (same line of code, but in my actual project this time):

d:/dev/gstflvhttpsink/amf.vala(54) : error C2059: syntax error : ','
amf.c(409) : error C2143: syntax error : missing '{' before '*'
amf.c(409) : error C2371: 'amf_mixed_array_new' : redefinition; different basic
types
d:/dev/gstflvhttpsink/amf.vala(250) : error C2172: 'gee_abstract_map_set' : actual parameter is not a pointer : parameter 3

I've tried all combinations of explicit base class constructor instantiation, including passing explicit arguments. Same errors occur.

I thought someone might find this interesting.
Comment 1 Luca Bruno 2012-04-30 05:36:07 UTC
You must box GLib.Value:

class MixedArray: Gee.HashMap<string, GLib.Value?> {}
Comment 2 Abdullah A. Hassan 2012-04-30 13:51:38 UTC
Yeah, sorry about that. I typed it from memory.

I forgot to mention that the compiler accepts it without throwing an error.

And in my project, even when boxed, doing something like this:

[Compact] class Message: Object
{
  struct Header
  {
    int dummy;
    // ...
  }
  class HeaderCollection: Gee.HashMap<string, GLib.Value?> {}
  HeaderCollection headers;
}

Causes GCC/CL to throw errors at the generated code.
Comment 3 Michael 'Mickey' Lauer 2018-02-18 23:08:57 UTC
Thanks for your bug report. With the current version I get the following error:

/tmp/bug675107.vala.c:48:158: error: expected expression
  ...(object_type, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_VALUE, (GBoxedCopyFunc) , (GDestroyNotify) g_value_uns...
Comment 4 GNOME Infrastructure Team 2018-05-22 14:24:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/296.