[clang] [LifetimeSafety] resolved lifetimeBound violation in constructor (PR #204797)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 22 01:41:45 PDT 2026
================
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -Wlifetime-safety-all -verify %s
+
+struct View {
+ View(const char* data [[clang::lifetimebound]]) : mData(data) {}
+ const char * data() const {
+ return mData;
+ }
+private:
+ const char* mData;
+};
+
+void test() {
----------------
NeKon69 wrote:
BTW, you don't actually need this function :)
https://github.com/llvm/llvm-project/pull/204797
More information about the cfe-commits
mailing list