mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 15:51:04 +01:00
This reverts commit bf6bb800c4.
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
// The behavior of this program is undefined because it tries to
|
||||
// access a local variable after its lifetime is over.
|
||||
|
||||
fn f() -> Int* {
|
||||
var int: x;
|
||||
x = 0;
|
||||
return &x;
|
||||
}
|
||||
|
||||
fn main() -> int {
|
||||
var Ptr(int): p;
|
||||
p = f();
|
||||
return *p;
|
||||
}
|
||||
Reference in New Issue
Block a user