Skip to content

Calling a proc inside a tuple inside a literal array, Nim compiler generates invalid C code #20544

Open
@AdamSpitz

Description

@AdamSpitz

What happened?

This gives me compile-time errors from gcc. Two questions:

  • Is this code invalid?
  • And even if this code is invalid, shouldn't the Nim compiler complain, rather than generating C code that gcc rejects?
type
  F = proc()
  T = tuple[c: F]

const
  f: F = proc() = echo "Got into the function."
  myTuple: T = (c: f)
  myLiteralArray: array[1, T] = [myTuple]

myLiteralArray[0].c()

Nim Version

Nim Compiler Version 1.7.3 [Linux: amd64]
Compiled at 2022-10-10
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: 1f20750
active boot switches: -d:release

Current Standard Output Logs

No response

Expected Standard Output Logs

No response

Possible Solution

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions