Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-89

compilation error on std::lower_bound<Iterator, T>() with Iterator::value_type != T

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.1.3
    • 4.1.4
    • 25. Algorithms
    • None
    • all

    Description

      On both the released ("incubating") and current subversion trunk versions of stdcxx, I trip across the following - I think it is your bug:

      "/home/duraid/stdcxx/include/algorithm.cc", line 1180: error #2304: no instance of function "_rw::_rw_lt<_TypeT>::operator() [with _Type
      T=std::iterator_traits<_rw::_rw_debug_iter<std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>, std::vector<llvm::Glob
      alValue *, std::allocator<llvm::GlobalValue *>>::pointer, std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>::pointer>>
      ::value_type]" matches the argument list
      argument types are: (std::iterator_traits<_rw::_rw_debug_iter<std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalVa
      lue *>>, std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>::pointer, std::vector<llvm::GlobalValue *, std::allocator<l
      lvm::GlobalValue *>>::pointer>::iterator_type>::value_type, const llvm::GlobalValue *const)
      object type is: _rw::rw_lt<std::iterator_traits<rw::_rw_debug_iter<std::vector<llvm::GlobalValue *, std::allocator<llvm:
      :GlobalValue *>>, std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>::pointer, std::vector<llvm::GlobalValue *, std::al
      locator<llvm::GlobalValue *>>::pointer>>::value_type>
      if (_comp (*_middle, __val)) {
      ^
      detected during instantiation of "RandomAccessIter std::_lower_bound(_RandomAccessIter, _RandomAccessIter, const _TypeT &, _Co
      mpare, Dist *, std::random_access_iterator_tag) [with _RandomAccessIter=rw::_rw_debug_iter<std::vector<llvm::GlobalValue *, std::alloc
      ator<llvm::GlobalValue *>>, std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>::pointer, std::vector<llvm::GlobalValue
      *, std::allocator<llvm::GlobalValue *>>::pointer>, TypeT=const llvm::GlobalValue *, _Compare=rw::rw_lt<std::iterator_traits<rw::_r
      w_debug_iter<std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>, std::vector<llvm::GlobalValue *, std::allocator<llvm::
      GlobalValue *>>::pointer, std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>::pointer>>::value_type>, _Dist=std::iterat
      or_traits<_rw::_rw_debug_iter<std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>, std::vector<llvm::GlobalValue *, st
      d::allocator<llvm::GlobalValue *>>::pointer, std::vector<llvm::GlobalValue *, std::allocator<llvm::GlobalValue *>>::pointer>>::difference_
      type]"

      Please see http://kinoko.c.u-tokyo.ac.jp/~duraid/stdcxxissues if you want to try and reproduce this. There, you will find the following files:

      DataStructure.cpp: the code I'm trying to build (it is a part of LLVM, http://www.llvm.org)

      Note: the problem is the const keyword on line 694 (const GlobalValue *V = Src[0]; ) - removing that keyword allows the file to be compiled, but I think the const keyword should be legal there.

      algorithmcc_bug.i: (preprocessed source: you should be able to compile this with aCC as follows:

      aCC -D__STDC_LIMIT_MACROS -AA -DNDEBUG -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG +d +w +W392 +W655 +W684 +W818 +W819 +W849 +W2193 +W2236 +W2261 +W2401 +W2487 +O2 -c algorithmcc_bug.i

      compile_log: what I see when trying to compile DataStructure.cpp with the const keyword present (grep for the error #2304)

      If you would like an account on the machine where I see this, just let me know!

      Attachments

        1. stdcxx-comparison.patch
          3 kB
          Duraid Madina

        Issue Links

          Activity

            People

              sebor Martin Sebor
              duraid Duraid Madina
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: