[llvm-bugs] [Bug 35755] New: GCC Compile error in DITypeRefArray and TypedMDOperandIterator

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 26 21:45:06 PST 2017


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

            Bug ID: 35755
           Summary: GCC Compile error in DITypeRefArray and
                    TypedMDOperandIterator
           Product: libraries
           Version: 4.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: maxime.arthaud at nasa.gov
                CC: llvm-bugs at lists.llvm.org

I am getting a compile error when I try to use llvm::DITypeRefArray::iterator
or llvm::TypedMDOperandIterator< llvm::DINode >. It only happens when compiling
with gcc, not clang. I tried with both llvm 4.0.1 and llvm 5.0.1

Test file: test.cpp
---
#include <llvm/IR/DebugInfoMetadata.h>

int main() {
  llvm::DITypeRefArray v;
  std::find(v.begin(), v.end(), llvm::DITypeRef());
  return 0;
}
---


Command: g++-7 -std=c++11 -Ipath-to-llvm/include test.cpp

Error:
---
In file included from
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/algorithm:62:0,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/STLExtras.h:20,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/StringRef.h:13,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/StringMap.h:17,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/Support/Host.h:17,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/Hashing.h:49,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/ArrayRef.h:13,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/IR/DebugInfoMetadata.h:17,
                 from test.cpp:1:
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_algo.h: In
instantiation of '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate)
[with _Iterator = llvm::DITypeRefArray::iterator; _Predicate =
__gnu_cxx::__ops::_Iter_equals_val<const llvm::TypedDINodeRef<llvm::DIType>
>]':
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_algo.h:3907:28:
  required from '_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter =
llvm::DITypeRefArray::iterator; _Tp = llvm::TypedDINodeRef<llvm::DIType>]'
test.cpp:5:50:   required from here
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_algo.h:162:34:
error: no matching function for call to
'__iterator_category(llvm::DITypeRefArray::iterator&)'
          std::__iterator_category(__first));
          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_algobase.h:65:0,
                 from
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/algorithm:61,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/STLExtras.h:20,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/StringRef.h:13,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/StringMap.h:17,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/Support/Host.h:17,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/Hashing.h:49,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/ADT/ArrayRef.h:13,
                 from
/Users/xxx/Homebrew/opt/llvm/include/llvm/IR/DebugInfoMetadata.h:17,
                 from test.cpp:1:
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_iterator_base_types.h:204:5:
note: candidate: template<class _Iter> typename
std::iterator_traits<_Iterator>::iterator_category
std::__iterator_category(const _Iter&)
     __iterator_category(const _Iter&)
     ^~~~~~~~~~~~~~~~~~~
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_iterator_base_types.h:204:5:
note:   template argument deduction/substitution failed:
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_iterator_base_types.h:
In substitution of 'template<class _Iter> typename
std::iterator_traits<_Iterator>::iterator_category
std::__iterator_category(const _Iter&) [with _Iter =
llvm::DITypeRefArray::iterator]':
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_algo.h:162:34: 
 required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate)
[with _Iterator = llvm::DITypeRefArray::iterator; _Predicate =
__gnu_cxx::__ops::_Iter_equals_val<const llvm::TypedDINodeRef<llvm::DIType> >]'
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_algo.h:3907:28:
  required from '_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter =
llvm::DITypeRefArray::iterator; _Tp = llvm::TypedDINodeRef<llvm::DIType>]'
test.cpp:5:50:   required from here
/Users/xxx/Homebrew/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/stl_iterator_base_types.h:204:5:
error: no type named 'iterator_category' in 'struct
std::iterator_traits<llvm::DITypeRefArray::iterator>'
---

I'm not sure what the problem is.
Side note: defining std::iterator_traits< llvm::DITypeRefArray::iterator > and
iterator_traits< llvm::TypedMDOperandIterator< llvm::DINode > > myself fixes
the issue.

-- 
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/20171227/34fd2d0c/attachment.html>


More information about the llvm-bugs mailing list