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 683686 - Compilation error with SimpleType struct
Compilation error with SimpleType struct
Status: RESOLVED DUPLICATE of bug 741466
Product: vala
Classification: Core
Component: Structs
0.17.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-09 22:10 UTC by fsukalia
Modified: 2017-03-09 21:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description fsukalia 2012-09-09 22:10:22 UTC
Following code throws an error by the native C compiler:

[SimpleType]
struct Foo {
	float bar;	
	public Foo (float bar) {
		this.bar = bar * 2;
	}	
	public void add (float a) {
		this.bar += a;
	}	
	public float get_bar () {
		return this.bar;
	}
}
void main () {
	Foo foo = Foo (2.5f);
	foo.add (3.5f);
	stdout.printf ("%f\n", foo.get_bar ());
}

The error occurs in the foo_init function, when the self parameter is passed to memset. The self parameter should cast to a void* pointer;
Comment 1 Rico Tzschichholz 2017-03-09 21:21:58 UTC

*** This bug has been marked as a duplicate of bug 741466 ***