mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 02:44:44 +00:00
Allow noreturn procs with void type (#6973)
This commit is contained in:
@@ -771,7 +771,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||
of wNoreturn:
|
||||
noVal(it)
|
||||
incl(sym.flags, sfNoReturn)
|
||||
if sym.ast[paramsPos][0].kind != nkEmpty:
|
||||
if sym.typ[0] != nil:
|
||||
localError(sym.ast[paramsPos][0].info, errNoReturnWithReturnTypeNotAllowed)
|
||||
of wDynlib:
|
||||
processDynLib(c, it, sym)
|
||||
|
||||
@@ -5,6 +5,10 @@ ccodeCheck: "\\i @'__attribute__((noreturn))' .*"
|
||||
proc noret1*(i: int) {.noreturn.} =
|
||||
echo i
|
||||
|
||||
|
||||
proc noret2*(i: int): void {.noreturn.} =
|
||||
echo i
|
||||
|
||||
var p {.used.}: proc(i: int): int
|
||||
doAssert(not compiles(
|
||||
p = proc(i: int): int {.noreturn.} = i # noreturn lambda returns int
|
||||
|
||||
Reference in New Issue
Block a user