Calling typeof on in-place constructed empty object crashes compiler
### Nim Version

Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-03-05
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 569d02e212774ca4745ad968d05b69b75a9bcec7
active boot switches:


### Description

Following code crashes the compiler.

```nim
type A = object

var a: typeof(A())
```

### Current Output

```text
/src/Nim/compiler/nim.nim(169) nim
/src/Nim/compiler/nim.nim(124) handleCmdLine
/src/Nim/compiler/main.nim(307) mainCommand
/src/Nim/compiler/main.nim(274) compileToBackend
/src/Nim/compiler/main.nim(137) commandCompileToC
/src/Nim/compiler/pipelines.nim(311) compilePipelineProject
/src/Nim/compiler/pipelines.nim(231) compilePipelineModule
/src/Nim/compiler/pipelines.nim(178) processPipelineModule
/src/Nim/compiler/pipelines.nim(25) processPipeline
/src/Nim/compiler/cgen.nim(2430) genTopLevelStmt
/src/Nim/compiler/injectdestructors.nim(1268) injectDestructorCalls
/src/Nim/compiler/optimizer.nim(284) optimize
/src/Nim/compiler/optimizer.nim(237) analyse
/src/Nim/compiler/optimizer.nim(237) analyse
/src/Nim/compiler/optimizer.nim(237) analyse
/src/Nim/compiler/optimizer.nim(237) analyse
/src/Nim/compiler/optimizer.nim(237) analyse
/src/Nim/compiler/optimizer.nim(131) analyse
/src/Nim/compiler/optimizer.nim(146) analyse
/src/Nim/compiler/ast.nim(2094) canRaise
/src/Nim/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]
```

### Expected Output

```text
Compiles.
```

### Known Workarounds

_No response_

### Additional Information

_No response_