<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 - Error on variadic template argument deduction including conversion to reference to const to Base"
   href="https://bugs.llvm.org/show_bug.cgi?id=40305">40305</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error on variadic template argument deduction including conversion to reference to const to Base
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Peter.Georg@physik.uni-regensburg.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21319" name="attach_21319" title="Minimal example to reproduce error/bug">attachment 21319</a> <a href="attachment.cgi?id=21319&action=edit" title="Minimal example to reproduce error/bug">[details]</a></span>
Minimal example to reproduce error/bug

Clang (7.0.0) fails to compile the example provided as clang-bug.cpp.
Command line: clang++ --std=c++17 clang-bug.cpp

It results in an internal error, however I expect this error is not the root
cause. The actual bug is clang being unable to deduce the variadic template
arguments.

Code (same as clang-bug.cpp):

template <class T, int... Ns>
class Base {};

template <class T, int... Ns>
class Derived : public Base<T, Ns...> {};

template <class... Ts, int... Ns>
void error(Base<Ts, Ns...> const &... arg) {}

int main() {
  Derived<int, 1> a, b;
  error(a, b);

  return 0;
}


Current work-around is to cast the objects to reference to const to Base before
calling the function. However this might not be feasible in any case and the
compiler should take care of this implicit conversion.

Works fine using GCC (see <a href="https://godbolt.org/z/x1DMHH">https://godbolt.org/z/x1DMHH</a>) and ICC.

Trunk fails as well.</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>