<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - GCC Compile error in DITypeRefArray and TypedMDOperandIterator"
   href="https://bugs.llvm.org/show_bug.cgi?id=35755">35755</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GCC Compile error in DITypeRefArray and TypedMDOperandIterator
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>maxime.arthaud@nasa.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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>
<span class="quote">>]':</span >
/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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>