Skip to content

default(T) breaks requiresInit requirements #25116

@arnetheduck

Description

@arnetheduck

Nim Version

2.2.4

Description

This compiles, though it shouldn't:

type RI {.requiresInit.} = object
  v: int

var v = default(RI) # should be flagged as invalid

requiresInit:

The compiler requires an explicit initialization for the object
and all of its fields

Current Output


Expected Output

compiler error

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions