title: Error in LLVM STLExtras: expected unqualified-id before 'const' with GCC11
body: <p>I just upgraded my compiler to GCC 11.1.0 and having trouble trying to compile my program that uses LLVM.</p>
  <p>The error that occurs is the following:</p>
  <pre><code>In file included from /usr/include/llvm/IR/DebugInfo.h:19,
                   from /home/&lt;redacted&gt;/src/sword/format/llvm.hpp:12,
                   from /home/&lt;redacted&gt;/src/main.cpp:9:
  /usr/include/llvm/ADT/STLExtras.h:1793:18: error: expected unqualified-id before ‘const’
   1793 |   result_pair&lt;R&gt;(const result_pair&lt;R&gt; &amp;Other)
        |                  ^~~~~
  /usr/include/llvm/ADT/STLExtras.h:1793:18: error: expected ‘)’ before ‘const’
   1793 |   result_pair&lt;R&gt;(const result_pair&lt;R&gt; &amp;Other)
        |                 ~^~~~~
        |                  )
  /usr/include/llvm/ADT/STLExtras.h:1843:22: error: expected unqualified-id before ‘const’
   1843 |   enumerator_iter&lt;R&gt;(const enumerator_iter&lt;R&gt; &amp;Other) : Result(Other.Result) {}
        |                      ^~~~~
  /usr/include/llvm/ADT/STLExtras.h:1843:22: error: expected ‘)’ before ‘const’
   1843 |   enumerator_iter&lt;R&gt;(const enumerator_iter&lt;R&gt; &amp;Other) : Result(Other.Result) {}
        |                     ~^~~~~
        |                      )
  
  </code></pre>
  <p>I've looked at the source code but wasn't sure whether LLVM's code is ill-formed, or it's a GCC bug.</p>
  <p>The error at line 1793 in STLExtra.h is related to the definition of a class:</p>
  <pre><code>template &lt;typename R&gt; struct result_pair {
    ...
    result_pair&lt;R&gt;(const result_pair&lt;R&gt; &amp;Other)
        : Index(Other.Index), Iter(Other.Iter) {}
    ...
  };
  </code></pre>
  <p>Usually, when I define a class with template parameters, I don't put the template parameters in the declaration of the constructor (i.e. <code>result_pair(...)</code>).
  And indeed, my program compiled fine when I modified the constructors from <code>result_pair&lt;R&gt;(...)</code> to <code>result_pair(...)</code> (Did the same for <code>enumerator_iter</code>).</p>
  <p>So, is LLVM's code wrong and GCC is correct? Or is this a GCC regression? My knowledge of the C++ standard is too limited to effectively Google to check whether this is a known bug or not... Any help is greatly appreciated.</p>
  <p>Also, I tried compiling my program using clang-11 but it fails to compile at all because the C++20 features are not there yet (specifically, it fails somewhere in  with templates). So, I couldn't narrow down the culprit that way.</p>
  <p>P.S. Since it compiles just fine with the modification, I guess I'll just leave the header modified for now.</p>