parent
6bd3a2826f
commit
2b3ec0a7c6
8 changed files with 131 additions and 14 deletions
18
tests/pragmas/tnoreturn.nim
Normal file
18
tests/pragmas/tnoreturn.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
discard """
|
||||
ccodeCheck: "\\i @'__attribute__((noreturn))' .*"
|
||||
"""
|
||||
|
||||
proc noret1*(i: int) {.noreturn.} =
|
||||
echo i
|
||||
|
||||
var p {.used.}: proc(i: int): int
|
||||
doAssert(not compiles(
|
||||
p = proc(i: int): int {.noreturn.} = i # noreturn lambda returns int
|
||||
))
|
||||
|
||||
|
||||
doAssert(not compiles(
|
||||
block:
|
||||
noret1(5)
|
||||
echo 1 # statement after noreturn
|
||||
))
|
||||
Loading…
Add table
Add a link
Reference in a new issue