Skip to content

Regression from 2.0 to version-2-2/devel in template overload resolution with generics #24146

Open
@tersec

Description

@tersec

Description

template g(h: typedesc): untyped = {.error: "2.0 doesn't hit".}
type
  S[Y] = array[Y.g, int]
  N = object
template g(_: type N): untyped = 1
discard sizeof(S[N])

Nim Version

Builds:

Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-09-21
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release
Nim Compiler Version 2.0.9 [Linux: amd64]
Compiled at 2024-09-21
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 27381cc60213e19aa34664176bd358ca5e45bd5a
active boot switches: -d:release

Does not build:

Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-21
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 755307be61e4ee7b32c8354b2c303d04bdfc3a3e
active boot switches: -d:release
Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-21
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: d51d88700b2fb3bd228d5e8f7385e2e4a2e2880c
active boot switches: -d:release

Current Output

/tmp/w.nim(3, 17) template/generic instantiation of `g` from here
/tmp/w.nim(1, 43) Error: 2.0 doesn't hit

Expected Output

No response

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to documentation content (not generation).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions