Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • vala vala
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 735
    • Issues 735
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 55
    • Merge requests 55
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • valavala
  • Issues
  • #350

Closed
Open
Created Jan 18, 2013 by Bugzilla@bugzilla-migration💬Reporter

constructor can't be chained from 'if'

Submitted by Ilya Mezhirov

Link to original bug (#692019)

Description

valac foo.vala; ./foo   -> Segmentation fault

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);
        }

Version: 0.18.x

Edited Nov 04, 2019 by Rico Tzschichholz
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking