[llvm-bugs] [Bug 50299] New: Bogus warnings: warning: 'allocator<void>' is deprecated

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 11 05:47:34 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50299

            Bug ID: 50299
           Summary: Bogus warnings: warning: 'allocator<void>' is
                    deprecated
           Product: libc++
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zilla at kayari.org
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com,
                    mcypark at gmail.com

#include <memory>

int main()
{
  std::allocator<void> a;
}


alloc.C:5:8: warning: 'allocator<void>' is deprecated
[-Wdeprecated-declarations]
  std::allocator<void> a;
       ^
/usr/bin/../include/c++/v1/memory:725:28: note: 'allocator<void>' has been
explicitly marked deprecated here
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void>
                           ^
/usr/bin/../include/c++/v1/__config:1035:39: note: expanded from macro
'_LIBCPP_DEPRECATED_IN_CXX17'
#  define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
                                      ^
/usr/bin/../include/c++/v1/__config:1012:48: note: expanded from macro
'_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^


This warning is misleading and unhelpful. It's true that the explicit
specialization is deprecated in C++17 and gone in C++20, but that doesn't mean
users can't use std::allocator<void> in C++20. It just means that doing so uses
the primary template.

It's perfectly fine to use std::allocator<void> in C++17 in limited ways (e.g.
you can't use it to allocate, obviously) and it's perfectly fine to use it in
the same ways in C++20. Telling users it's deprecated is totally unhelpful,
because they don't need to stop using it, but they can't do anything about the
warnings except to stop using it.

What purpose do the warnings serve? What do you expect users to do if they get
that warning? Why should they change their code, when there's nothing wrong
with it?

Please revert the additions of the deprecated attributes here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210511/795404dc/attachment-0001.html>


More information about the llvm-bugs mailing list