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 689924 - Erroneous c code generated when accessing HashTable constructor as a base constructor
Erroneous c code generated when accessing HashTable constructor as a base con...
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other Linux
: Normal major
: 1.0
Assigned To: Vala maintainers
Vala maintainers
Depends on: 669541
Blocks:
 
 
Reported: 2012-12-09 10:53 UTC by Andreas Obergrusberger
Modified: 2018-05-22 14:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase which gives rise to the problem. (403 bytes, text/x-vala)
2012-12-09 10:53 UTC, Andreas Obergrusberger
Details

Description Andreas Obergrusberger 2012-12-09 10:53:54 UTC
Created attachment 231059 [details]
Testcase which gives rise to the problem.

Dear hard-working vala developers :)

When deriving a class from HashTable and accessing its base constructor (i.e. the constructor of HashTable) using 

base(str_hash, str_equal);

valac generates this bad c code (where "Derived" is the name of the class derived from HashTable):

self = (Derived*) g_hash_table_new_full (_tmp0_, _tmp1_);

But g_hash_table_new_full requires two more parameters.

Constructing a HashTable using

HashTable table = new HashTable<string, string> (str_hash, str_equal);

works. So does accessing the base constructor by writing

base.full(str_hash, str_equal, null, null);

I attached a testcase for this.
Comment 1 Daniel Espinosa 2017-03-13 21:32:39 UTC
While possible,Vala have much better support of GObject derived classes, then this issues will produce extrange C code generation behavior.

Developer should be encouraged to use GObject derived classes. If good support is wanted, then use them to wrap up non GObject types.

So this bug could be set to enhancement and tagged for 1.2 milestone.
Comment 2 GNOME Infrastructure Team 2018-05-22 14:38:07 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/342.