[clang] [Clang] emit -Wignored-qualifiers diagnostic for cv-qualified base classes (PR #121419)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 07:00:49 PST 2025


ldionne wrote:

> > @erichkeane @ldionne should the `libcxx` tests ([common_reference.compile.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp), [apply_extended_types.pass.cpp](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply_extended_types.pass.cpp)) be updated or should the new warnings/errors be treated as the new baseline?
> 
> This is entirely a @ldionne question, though I see in github that he's on vacation at the moment, so we'll have to wait until he returns.

Thanks for the ping. I've returned but Github doesn't clear the vacation status automatically - fixed now.

This seems reasonable to me, we should "fix" libc++. I think this should do it:

```diff
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index aca14ba408d3..90257e9bae0a 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -257,6 +257,7 @@ template <class... Types>
 #  include <__type_traits/maybe_const.h>
 #  include <__type_traits/nat.h>
 #  include <__type_traits/negation.h>
+#  include <__type_traits/remove_cv.h>
 #  include <__type_traits/remove_cvref.h>
 #  include <__type_traits/remove_reference.h>
 #  include <__type_traits/unwrap_ref.h>
@@ -535,7 +536,7 @@ __memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up
 
 template <class... _Tp>
 class _LIBCPP_TEMPLATE_VIS tuple {
-  typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
+  typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, __remove_cv_t<_Tp>...> _BaseT;
 
   _BaseT __base_;
 
```

https://github.com/llvm/llvm-project/pull/121419


More information about the cfe-commits mailing list