aboutsummaryrefslogblamecommitdiff
path: root/tests/run/t8601c.scala
blob: 946a4d4b69b105a674ded6e2907e5fbbcb8bf231 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                                                               
object Test {
  def loadField(x: scala.runtime.IntRef): Unit = x.elem
  def storeField(x: scala.runtime.IntRef): Unit = x.elem = 42

  def check(x: => Any) = try { x; sys.error("failed to throw NPE!") } catch { case _: NullPointerException => }

  def main(args: Array[String]): Unit = {
    check(loadField(null)) // bug: did not NPE under -Ydead-code
    check(storeField(null))

  }
}