[libcxx-commits] [libcxx] [libc++] Diagnose unused variables of container types (PR #203084)

Yuxuan Chen via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 19 07:31:50 PDT 2026


================
@@ -84,7 +84,7 @@ _LIBCPP_PUSH_MACROS
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp, class _Allocator /* = allocator<_Tp> */>
-class vector {
+class [[__gnu__::__warn_unused__]] vector {
----------------
yuxuanchen1997 wrote:

> True, but I kinda doubt this is in any way common. If we find it is we can revise later.

The best way to do that would be trying to build some large applications with this patch and address any mislabeling. 

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


More information about the libcxx-commits mailing list