mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
fixes #24526, follows up #23101 The `shallowCopy` calls do not keep the original node's children, they just make a new seq with the same length, so the `Ident "*"` node from the original postfix nodes was not carried over, making it `nil` and causing the segfault.
25 lines
521 B
Nim
25 lines
521 B
Nim
# issue #24526
|
|
|
|
import std/macros
|
|
|
|
template prag {.pragma.}
|
|
|
|
type
|
|
Foo1* = ref object of RootObj
|
|
name*: string
|
|
Foo2* {.used.} = ref object of RootObj
|
|
name*: string
|
|
Foo3* {.prag.} = ref object of RootObj
|
|
name*: string
|
|
Foo4* {.used, prag.} = ref object of RootObj
|
|
name*: string
|
|
|
|
# needs to have `typedesc` type
|
|
proc foo(T: typedesc): bool =
|
|
T.hasCustomPragma(prag)
|
|
|
|
doAssert not foo(typeof(Foo1()[]))
|
|
doAssert not foo(typeof(Foo2()[]))
|
|
doAssert foo(typeof(Foo3()[]))
|
|
doAssert foo(typeof(Foo4()[]))
|