1 // Due to a compiler bug, if a return occurs outside of a function body
2 // (e.g. in an AnonConst body), the return value expression would not be
3 // type-checked, leading to an ICE. This test checks that the ICE no
4 // longer happens, and that an appropriate error message is issued that
5 // also explains why the return is considered "outside of a function body"
6 // if it seems to be inside one, as in the main function below.
10 //~^ ERROR: return statement outside of function body [E0572]
19 //~^ NOTE: ...not the enclosing function body
21 //~^ ERROR: return statement outside of function body [E0572]
22 //~| NOTE: the return is part of this body...
27 //~^ NOTE: ...not the enclosing function body
29 //~^ ERROR: return statement outside of function body [E0572]
30 //~| NOTE: the return is part of this body...
35 //~^ NOTE: ...not the enclosing function body
37 //~^ ERROR: return statement outside of function body [E0572]
38 //~| NOTE: the return is part of this body...