[llvm-bugs] [Bug 40305] New: Error on variadic template argument deduction including conversion to reference to const to Base

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 14 03:35:42 PST 2019


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

            Bug ID: 40305
           Summary: Error on variadic template argument deduction
                    including conversion to reference to const to Base
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Peter.Georg at physik.uni-regensburg.de
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 21319
  --> https://bugs.llvm.org/attachment.cgi?id=21319&action=edit
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 https://godbolt.org/z/x1DMHH) and ICC.

Trunk fails as well.

-- 
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/20190114/8cd3a76c/attachment.html>


More information about the llvm-bugs mailing list