Source file src/cmd/compile/internal/test/testdata/deferNoReturn_test.go

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Test that a defer in a function with no return
     6  // statement will compile correctly.
     7  
     8  package main
     9  
    10  import "testing"
    11  
    12  func deferNoReturn_ssa() {
    13  	defer func() { println("returned") }()
    14  	for {
    15  		println("loop")
    16  	}
    17  }
    18  
    19  func TestDeferNoReturn(t *testing.T) {
    20  	// This is a compile-time test, no runtime testing required.
    21  }
    22  

View as plain text