llvm / llvm/llvm-project

[LifetimeSafety] False-negative in lifetimebound base class constructor

Open
#192,453 1 comment 0 reactions 0 assignees View on GitHub
clang:temporal-safety false-negative
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```cpp
struct T {};

struct S {
S(const T& t [[clang::lifetimebound]]);
};

struct S2 : S {
S2() : S(T{}) {} // Here S will outlive T{} but it does not trigger.
};
```
https://godbolt.org/z/WsnWzaEn6

Contributor guide

Open the contributing guide

Research direction

Start with the reduced C++ reproducer in the issue and compare its behavior using the linked Compiler Explorer example. Trace the lifetimebound diagnostic handling for a base-class constructor call, then confirm that the shown temporary-lifetime case produces the expected warning without introducing diagnostics for valid code.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.