[LLVMbugs] [Bug 10147] New: too few template arguments for class template 'set'
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 16 09:23:09 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10147
Summary: too few template arguments for class template 'set'
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: hhinnant at apple.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
I have a report that the following code example compiles with gcc 4.6.0. It
does not compile with:
Apple clang version 3.0 (trunk 133051) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.7.0
Thread model: posix
I do not know if clang is correct or incorrect in rejecting this program.
#include <set>
#include <cstdint>
#include <tuple>
template<typename PackR, typename PackL>
struct Cat;
template<typename ...R, typename ...L>
struct Cat<std::tuple<R...>, std::tuple<L...>>
{
typedef std::tuple<R..., L...> type;
};
template<typename Pack, template<typename ...T> class Receiver>
struct Unpack;
template<typename ...Args, template<typename ...T> class Receiver>
struct Unpack<std::tuple<Args...>, Receiver>
{
typedef Receiver<Args...> type;
};
template<typename ...Args>
struct Forward
{
//typedef Args... args; // Problem here!!
typedef std::tuple<Args...> args; // Workaround
static const std::size_t size = sizeof...(Args);
};
template<typename S, typename T,
template<typename ...SArgs> class SCont,
template<typename ...TArgs> class TCont,
typename SForward = Forward<> ,
typename TForward = Forward<>>
class Bimap
{
//typedef SCont<S, typename SForward::args> left_type;
//typedef TCont<T, typename TForward::args> right_type;
typedef typename Unpack<typename Cat<std::tuple<S>, typename
SForward::args>::type, SCont>::type left_type; //Workaround
typedef typename Unpack<typename Cat<std::tuple<T>, typename
TForward::args>::type, TCont>::type right_type; //Workaround
template<typename LeftIt, typename RightIt> struct Relation; // to be
implemented
typedef Relation<typename left_type::const_iterator, typename
right_type::const_iterator> relation_type;
};
int main()
{
Bimap<int, int, std::set, std::set, Forward<std::less<int>> ,
Forward<std::greater<int>>> x;
}
test.cpp:20:17: error: too few template arguments for class template 'set'
typedef Receiver<Args...> type;
^
test.cpp:41:26: note: in instantiation of template class
'Unpack<std::__1::tuple<int, std::__1::less<int> >, set>' requested here
typedef typename Unpack<typename Cat<std::tuple<S>, typename
SForward::args>::type, SCont>::type left_type; //Workaround
^
test.cpp:52:95: note: in instantiation of template class 'Bimap<int, int,
std::set, std::set, Forward<std::__1::less<int> >,
Forward<std::__1::greater<int> > >' requested here
Bimap<int, int, std::set, std::set, Forward<std::less<int>> ,
Forward<std::greater<int>>> x;
^
/usr/include/c++/v1/__tree:33:27: note: template is declared here
class _LIBCPP_VISIBLE set;
^
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list