Skip to content

[[lifetimebound]] basic members tracking #81589

Closed
@DenisYaroshevskiy

Description

@DenisYaroshevskiy

Hi!

Would be amazing if the following is caught to:

https://godbolt.org/z/5ze9s5roj

#include <utility>

struct Struct {
  std::pair<int, int> member;

  const auto* foo() const [[clang::lifetimebound]] { return &member; }
};

int main() {
  // auto& caught = *Struct().foo();
  auto& not_caught = Struct().foo()->second;  // this is a bug
  (void)not_caught;
}

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions