[llvm-bugs] [Bug 27155] New: Template argument deduction for base class fails

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 31 01:39:53 PDT 2016


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

            Bug ID: 27155
           Summary: Template argument deduction for base class fails
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: roman.perepelitsa at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

struct B {};

  template <class T, int>
  struct D : T {};

  template <class T>
  void Foo(D<T, 0>);

  int main() {
    Foo(D<D<B, 0>, 1>());
  }

Clang erroneously rejects this code:

  10 : error: no matching function for call to 'Foo'
  Foo(D<D<B, 0>, 1>());
  ^~~
  7 : note: candidate template ignored: could not match 0 against 1
  void Foo(D<T, 0>);
  ^

However, it accepts this very similar code:

  template <class T, int>
  struct S {};

  template <class T>
  struct S<T, 1> : S<T, 0> {};

  template <class T>
  void Foo(S<T, 0>);

  int main() {
    Foo(S<void, 1>());
  }

-- 
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/20160331/e52f21a2/attachment.html>


More information about the llvm-bugs mailing list