Skip to content

Multiple constraints with the first is of type void crashes compiler #7355

@alaviss

Description

@alaviss

Code snippet:

proc gen[A: void, T: void|int](a: A, b: T) = discard

gen[void, void]()     # Works
gen[void, int] 0      # Crash
gen[void, int](b = 0) # Crash

Compiler output:

Hint: used config file '/etc/nim.cfg' [Conf]
Hint: system [Processing]
Hint: crash [Processing]
Traceback from system (most recent call last)
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

nim version:

Nim Compiler Version 0.18.1 [Linux: amd64]
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: cc5140d8b6ea8ca65ec9b74348cf23aec09d6723
active boot switches: -d:release -d:nativeStackTrace

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