================
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -fsyntax-only -Wlifetime-safety-validations -Wno-dangling 
-verify %s
+
+struct MyObj {
+  ~MyObj() {}
+};
+
+struct S {
+  MyObj data;
+  const MyObj &implicit_this_only(); // expected-warning {{'lifetimebound' 
attribute on the definition is not visible to callers; add it to this 
declaration instead}}
+  const MyObj &param_only(const MyObj &obj); // expected-warning 
{{'lifetimebound' attribute on the definition is not visible to callers; add it 
to this declaration instead}}
+  const MyObj &both(const MyObj &obj, bool); // expected-warning 2 
{{'lifetimebound' attribute on the definition is not visible to callers; add it 
to this declaration instead}}
----------------
usx95 wrote:

Suggestion for warning text:
`'lifetimebound' attribute should be on the declaration to be visible to 
callers`

https://github.com/llvm/llvm-project/pull/197753
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to