summary refs log tree commit diff stats
path: root/tests/notnil/tnotnil2.nim
blob: bd6b8b67550ff6cc1503f88890d3995a6e3abfd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
discard """
  errormsg: "cannot prove 'y' is not nil"
  line:20
"""

import strutils


type
  TObj = object
    x, y: int

proc q(x: pointer not nil) =
  nil

proc p() =
  var x: pointer
  let y = x
  if not y.isNil or y != x:
    q(y)
  else:
    q(y)

p()