# add behavior test: return undefined pointer from function · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/0e47bd16dac9dcdfc12168c07104030af8eaaa8b)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 0e47bd16dac9dcdfc12168c07104030af8eaaa8b

Requested commit: 0e47bd16dac9dcdfc12168c07104030af8eaaa8b

Commit: 0e47bd16dac9dcdfc12168c07104030af8eaaa8b

Tree: f0187c40b264ad1a85d9f050a43074c3e38ef23b

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
add behavior test: return undefined pointer from function

This clarifies that it is legal to return an invalid pointer from a
function, provided that such pointer is not dereferenced.

This matches current status quo of the language. Any change to this
should be a proposal that argues for different semantics.

It is also legal in C to return a pointer to a local. The C backend
lowers such thing directly, so the corresponding warning in C must be
disabled (`-Wno-return-stack-address`).

```

## Parents

- [4d1b15bd9d4175127a63595f4fd80761c2e6564c](https://git.cafe/gitcafe/zig/commit/4d1b15bd9d4175127a63595f4fd80761c2e6564c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/0e47bd16dac9dcdfc12168c07104030af8eaaa8b?format=markdown)
