Skip to content
GitLab
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 769
    • Issues 769
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 75
    • Merge requests 75
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and 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
  • GNOMEGNOME
  • valavala
  • Issues
  • #464
Closed
Open
Issue created Aug 05, 2014 by Bugzilla@bugzilla-migration💬Reporter

struct inheritance between multiple files does not compile in C.

Submitted by Lim Jongrok

Link to original bug (#734295)

Description

When a struct inherits from other struct in other file, it does compile at vala level (generation of C Code), but it does not compile at C level with a "Unknown Type" error.

This can be reproduced with any struct inheritance, which one of more of struct definitions are separated in other file(s), and here is one of example. which has two struct in each file.

astruct.vala: (also attached)

public struct AStruct { public int a_field; }

bstruct.vala: (also attached)

public struct BStruct: AStruct { }

bar.vala: (also attached)

public static int main (string[] args) { BStruct bstruct = new BStruct (); return 0; }

[wsid@WSIDPC ~]$ valac --version Vala 0.25.1

[wsid@WSIDPC ~]$ valac astruct.vala bstruct.vala bar.vala bar.vala:2.20-2.33: warning: deprecated syntax, don't use new' to initialize structs BStruct bstruct = new BStruct (); ^^^^^^^^^^^^^^ bar.vala:2.10-2.33: warning: local variable bstruct' declared but never used BStruct bstruct = new BStruct (); ^^^^^^^^^^^^^^^^^^^^^^^^ /home/wsid/bstruct.vala.c:11:9: error: unknown type name ‘AStruct’ typedef AStruct BStruct; ^ /home/wsid/bar.vala.c:12:9: error: unknown type name ‘AStruct’ typedef AStruct BStruct; ^ error: cc exited with status 256 Compilation failed: 1 error(s), 2 warning(s)

[wsid@WSIDPC ~]$ valac astruct.vala bstruct.vala bar.vala -C bar.vala:2.20-2.33: warning: deprecated syntax, don't use new' to initialize structs BStruct bstruct = new BStruct (); ^^^^^^^^^^^^^^ bar.vala:2.10-2.33: warning: local variable bstruct' declared but never used BStruct bstruct = new BStruct (); ^^^^^^^^^^^^^^^^^^^^^^^^ Compilation succeeded - 2 warning(s)

The generated C files are attached, and bstruct.c and bar.c lacks of definition of AStruct.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking