Issue |
141906
|
Summary |
-Wreturn-stack-address false negative
|
Labels |
false-negative
|
Assignees |
|
Reporter |
JVApen
|
````
#include <tuple>
#include <iostream>
struct A {
int i;
};
auto getA(int i) -> const A& {
std::tuple<A> tuple = std::make_tuple<A>(A{i});
return std::get<A>(tuple);
}
int main() {
std::cout << getA(9).i;
}
````
[Code on compiler-explorer](https://godbolt.org/z/1G11j9z3d)
MSVC does report a warning here: `warning C4172: returning address of local variable or temporary : tuple`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs