[llvm-bugs] [Bug 50716] New: Undefined use of std::deque<const int> in std::assignable_from test

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 15 04:48:34 PDT 2021


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

            Bug ID: 50716
           Summary: Undefined use of std::deque<const int> in
                    std::assignable_from test
           Product: libc++
           Version: 12.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          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

The tests for std::assignable_from use std::deque<const int> which is undefined
because it uses std::allocator<const int>. The Cpp17Allocator requirements say
the value type must be a non-const, non-volatile object type:

In file included from /home/jwakely/gcc/12/include/c++/12.0.0/deque:67,
                 from
std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp:17:
/home/jwakely/gcc/12/include/c++/12.0.0/bits/stl_deque.h: In instantiation of
'class std::deque<const int>':
/home/jwakely/gcc/12/include/c++/12.0.0/type_traits:3423:12:   recursively
required by substitution of 'template<class _Tp1, class _Tp2> struct
std::__common_reference_impl<_Tp1&&, _Tp2&, 1, std::void_t<typename
std::__common_ref_impl<_Tp1&&, _Tp2&, void>::type> > [with _Tp1 = const
std::deque<int>; _Tp2 = const std::deque<const int>]'
/home/jwakely/gcc/12/include/c++/12.0.0/type_traits:3423:12:   required from
'struct std::common_reference<const std::deque<int, std::allocator<int> >&,
const std::deque<const int, std::allocator<const int> >&>'
std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp:138:18:
  required from 'constexpr bool CheckAssignableFromLvalues() [with T1 =
std::deque<int>; T2 = std::deque<const int>]'
std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp:147:44:
  required from 'constexpr bool CheckAssignableFromLvaluesAndRvalues() [with T1
= std::deque<int>; T2 = std::deque<const int>]'
std/concepts/concepts.lang/concept.assignable/assignable_from.compile.pass.cpp:443:76:
  required from here
/home/jwakely/gcc/12/include/c++/12.0.0/bits/stl_deque.h:778:66: error: static
assertion failed: std::deque must have a non-const, non-volatile value_type
  778 |       static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value,
      |                                                                  ^~~~~

Implementations are not required to support that usage. Should that
non-portable test be guarded by a preprocessor check for _LIBCPP_VERSION or
similar?

-- 
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/20210615/9ab6c394/attachment.html>


More information about the llvm-bugs mailing list