================ @@ -852,3 +852,27 @@ struct Test { }; } // namespace GH120543 + +namespace GH127195 { +template <typename T> +struct StatusOr { + T* operator->() [[clang::lifetimebound]]; + T* value() [[clang::lifetimebound]]; +}; + +const char* foo() { + StatusOr<std::string> s; + return s->data(); // expected-warning {{address of stack memory associated with local variable}} + + StatusOr<std::string_view> s2; + return s2->data(); + + StatusOr<StatusOr<std::string_view>> s3; + return s3.value()->value()->data(); + + // would be nice to support the nested cases. + StatusOr<StatusOr<std::string>> s4; ---------------- usx95 wrote:
nit: Begin sentence with FIXME. https://github.com/llvm/llvm-project/pull/127460 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits