Unverified Commit 9dab2e30 authored by Youngsuk Kim's avatar Youngsuk Kim Committed by GitHub
Browse files

[clang][Sema] Warn on return of pointer/reference to compound literal (#83741)

Emit a warning if pointer/reference to compound literal is returned from
a function.

In C, compound literals in block scope are lvalues that have automatic
storage duration. In C++, compound literals in block scope are
temporaries.

In either case, returning a pointer/reference to a compound literal can
cause a use-after-free bug.

Fixes #8678
parent 0fbe45bd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment