GNOME Bugzilla – Bug 692019
constructor can't be chained from 'if'
Last modified: 2018-05-22 14:40:17 UTC
Created attachment 233770 [details] valac foo.vala; ./foo -> Segmentation fault $ valac --version Vala 0.18.1 A problem arises when a chain constructor call is inside an if. This code gives segmentation fault. _________________________ class Foo { int x; public Foo() { x = 1; } public Foo.maybe_chain(bool chain) { if (chain) this(); x = 3; print("b\n"); } } void main() { new Foo.maybe_chain(false); } _________________________ The compiler only creates self inside if: if (_tmp0_) { self = (Foo*) foo_construct (object_type); }
-- 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/350.