SIGSEGV:  Object with pure enum in proc
### Description

Crashes the compiler from #23976.

### Nim Version

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

git hash: 832ba815d1cf7ec0846cdade49f697228bb04d22
active boot switches: -d:release

### Current Output

```text
Hint: used config file '/home/fox/git/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/fox/git/Nim/config/config.nims' [Conf]
.....................................................................SIGSEGV: Illegal storage access. (Attempt to read from nil?)
fish: Job 1, '~/git/Nim/bin/nim c main' terminated by signal SIGSEGV (Address boundary error)
```


### Expected Output

_No response_

### Possible Solution

_No response_

### Additional Information

```nim
type
  Enum {.pure.} = enum
    a

  Obj = object
    a: Enum

proc test(a: Enum) = discard Obj(a: a)
```