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 530369 - Length function transform pointer to gpointer
Length function transform pointer to gpointer
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.3.x
Other All
: High normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-04-28 14:47 UTC by sanpi
Modified: 2008-05-26 12:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description sanpi 2008-04-28 14:47:39 UTC
Please describe the problem:
Hello,

length method cast _this_ parameter in gpointer. This make problem when C function is a macro.

An example with Xml.NodeSet.length:
--------------------------------------------------------------------------------
Xml.NodeSet* node = ...;

nodes->length ();
--------------------------------------------------------------------------------

is transformed to c code:
--------------------------------------------------------------------------------
xmlXPathNodeSetGetLength (((gpointer) nodes));
--------------------------------------------------------------------------------

but xmlXPathNodeSetGetLength is macro extend to:
--------------------------------------------------------------------------------
 ((ns) ? (ns)->nodeNr : 0)
--------------------------------------------------------------------------------

Makes an error:
--------------------------------------------------------------------------------
warning: dereferencing 'void *' pointer
error: request for member 'nodeNr' in something not a structure or union
--------------------------------------------------------------------------------

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
I don't know if that is specific to this Xml.NodeSet.length function.
Comment 1 Jürg Billeter 2008-05-07 21:16:38 UTC
Confirming.

void main () {
	Xml.NodeSet* nodes;
	int i = nodes->length ();
}
Comment 2 sanpi 2008-05-11 23:08:56 UTC
I have same problem with xmlXPathNodeSetItem macro.
Comment 3 sanpi 2008-05-19 07:26:00 UTC
Hello,

This problem prevents me to continue the development of a project.

Is there a solution, even temporary, to compile my project?
Comment 4 Jürg Billeter 2008-05-26 12:31:27 UTC
2008-05-26  Jürg Billeter  <j@bitron.ch>

        * gobject/valaccodeinvocationexpressionbinding.vala:

        Fix implicit casts for instances in invocation expressions,
        fixes bug 530369

Fixed in r1449.