[LLVMbugs] [Bug 22601] New: defaulted class template parameters dropped when rededucing template template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 15 22:40:38 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22601

            Bug ID: 22601
           Summary: defaulted class template parameters dropped when
                    rededucing template template parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eniebler at boost.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code compiles successfully with gcc and fails with clang. I
honestly don't know for certain who is right here, but I would really like gcc
to be right.

template<typename...> struct list;

template<template<typename...> class A>
struct wrap
{
  template<typename X, typename T = wrap>
  struct impl;
  template<typename...X, template<typename...> class D>
  struct impl<list<X...>, wrap<D>>
  {
    using type = D<X...>;
  };
  template<typename...T>
  using apply = typename impl<list<T...>>::type;
};

template<typename A, typename B> struct L;
template<typename A, typename B = void> struct L {};

int main()
{
  wrap<L>::apply<int> s;
}

The error clang gives is:

test.cpp:15:18: error: too few template arguments for class template 'L'
    using type = D<X...>;
                 ^
test.cpp:18:3: note: in instantiation of template class
      'wrap<L>::impl<list<int>, wrap<L> >' requested here
  using apply = typename impl<list<T...>>::type;
  ^
test.cpp:28:12: note: in instantiation of template type alias 'apply' requested
here
  wrap<L>::apply<int> s;
           ^
test.cpp:23:41: note: template is declared here
template<typename A, typename B> struct L;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~        ^
1 error generated.

-- 
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/20150216/78d7c39f/attachment.html>


More information about the llvm-bugs mailing list