Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
vala
vala
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 702
    • Issues 702
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 38
    • Merge Requests 38
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GNOME
  • valavala
  • Issues
  • #198

Closed
Open
Opened Apr 30, 2011 by bugzilla-migration@bugzilla-migrationReporter

Structure initialiser doesn't support designated initialisers

Submitted by David given

Link to original bug (#649009)

Description

This works:

struct Foo { int a; int b; int c; } Foo foo = new Foo() { c=1, b=2, a=3 } (this creates a new inline instance and initialised foo by assignment)

...but this doesn't:

Foo foo = { c=1, b=2, a=3 } (this initialises foo in-place)

Also, this is accepted but produces bad code:

Foo foo = { c:1, b:2, a:3 } (the tags are ignored and the fields are initialised in order)

I'm not sure what's going on there, but as this syntax is used by other languages and it looks like it works, it probably shouldn't.

Version: 0.12.x

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/vala#198