[LLVMbugs] [Bug 18783] New: Wrong "too few template arguments for class template"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 9 05:09:41 PST 2014


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

            Bug ID: 18783
           Summary: Wrong "too few template arguments for class template"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marc.glisse at normalesup.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

(If we replace type_traits with boost, this is C++03)

#include <type_traits>

template<class,class> struct typeset;
template<class H=void, class T=typename
std::conditional<std::is_same<H,void>::value, void, typeset<void, void> >::type
>
struct typeset {
  typedef typeset type;
};
template<> struct typeset<> {
  typedef typeset type;
  template<class X> struct add : typeset<X> {};
};

typedef typeset<>::add<int>::type XXX;


t.cc:11:34: error: too few template arguments for class template 'typeset'
  template<class X> struct add : typeset<X> {};
                                 ^
t.cc:3:30: note: template is declared here
template<class,class> struct typeset;
~~~~~~~~~~~~~~~~~~~~~        ^
t.cc:14:9: error: no type named 'type' in 'typeset<void, void>::add<int>'; did
      you mean 'typeset<>::type'?
typedef typeset<>::add<int>::type XXX;
        ^~~~~~~~~~~~~~~~~~~~~~~~~
        typeset<>::type
t.cc:10:19: note: 'typeset<>::type' declared here
  typedef typeset type;
                  ^

Note that if I write ::typeset<X> (adding :: in front) it compiles.

Could be related to bug 10147.

-- 
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/20140209/ebe26544/attachment.html>


More information about the llvm-bugs mailing list