Skip to content

[Concepts] Recursive concepts cause a compiler segfault when testing with is #17630

Open
@konsumlamm

Description

@konsumlamm

Example

type
  A = concept
    proc test(x: Self, y: A)

proc test(x: int, y: int) = discard

discard (int is A)

Current Output

The compiler crashes.

SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Expected Output

An error message or successful compilation.

Possible Solution

  • Disallow referring to the concept being defined inside its definition.

Additional Information

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-04-02
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 9abd383
active boot switches: -d:release

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