[clang] [clang] Implement `__builtin_is_implicit_lifetime()` (PR #101807)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 13 03:38:08 PDT 2024
Endilll wrote:
> @Endilll "the program is ill-formed if overload resolution fails" means that there must be exactly one valid prospective destructor.
>
> So this is perfectly fine
>
> ```c++
> template <typename T>
> struct S {
> ~S() = default;
> ~S() requires false;
> };
> S<int> s;
> ```
Sure, but the constraint here doesn't really decide whether `S<T>` is an implicit-lifetime class or not. Rather, it decides whether `S<T>` is well-formed. I was reading that paragraph from the point of a different (hypothetical) example:
```cpp
template <bool B>
struct S {
~S() requires B {};
};
static_assert(!__builtin_is_implicit_lifetime(S<true>));
static_assert(__builtin_is_implicit_lifetime(S<false>));
```
What I actually meant is that such an example where a dependent constraint on destructor decides whether a class is implicit-lifetime doesn't seem possible (or it would be testing something else, like in your example). Sorry for the confusion.
https://github.com/llvm/llvm-project/pull/101807
More information about the cfe-commits
mailing list