[libcxx-commits] [libcxx] [libc++] Make `std::reference_constructs_from_temporary` SFINAE friendly when the 1st template argument is not a reference type (PR #206679)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 2 03:16:13 PDT 2026
philnik777 wrote:
> > I'm not convinced this is worth the complexity. This adds a workaround for older compilers, so this will be obsolete in a year anyways, and for that it's way too complicated of a fix IMO.
>
> I agree that introducing `__complete` and `__complete_or_unbounded` solely as a workaround for older compiler bugs is not ideal—the added complexity is hard to justify for a temporary fix.
>
> That said, I believe these traits could have broader value in libc++ development. They are analogous to `__is_complete_or_unbounded`, which is used extensively in libstdc++ to produce readable static assertions and to help maintainers write robust, self-documenting code. A few examples:
>
> * In `std::copyable_function`:
> https://gcc.gnu.org/git?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/bits/funcref_impl.h;h=9fcab570803fd7ab25ceb2556764005243f83aa4;hb=HEAD#l71
>
> * In `std::function_ref`:
> https://gcc.gnu.org/git?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/bits/funcref_impl.h;h=8a00fde1b8e54ef20555efac9a9f1406559c9648;hb=HEAD#l72
>
> * In `__pass_by_value`:
> https://gcc.gnu.org/git?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/bits/funcwrap.h;h=670efa63b4a242d83953eaf4a832c4998cdac696;hb=HEAD#l220
>
>
> @philnik777 Do you think it would be worthwhile to open a separate discussion about adding `__complete` and `__complete_or_unbounded` to `__type_traits` to explore these long-term benefits? I’d be happy to file a new issue if that seems reasonable.
You can, but I'm not convinced they're worth adding. All the type traits are already diagnosed by the compiler, so the application is _very_ limited.
https://github.com/llvm/llvm-project/pull/206679
More information about the libcxx-commits
mailing list