[LLVMbugs] [Bug 10139] New: unordered_set declared inside class
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jun 14 23:15:30 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10139
Summary: unordered_set declared inside class
Product: libc++
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
AssignedTo: hhinnant at apple.com
ReportedBy: oroppas at gmail.com
CC: llvmbugs at cs.uiuc.edu
The following piece of code cannot be compiled by clang with libc++:
#include <unordered_set>
class FlowGraph
{
public:
typedef unsigned int RegisterId;
class Register
{
public:
RegisterId _id;
Register( RegisterId id = 0 ) : _id(id) { }
bool operator==( const Register& r ) const
{
return _id == r._id;
}
};
typedef std::unordered_set< Register > RegisterSet;
private:
RegisterSet _In;
};
int main()
{
return 0;
}
$ clang++ -g -O0 -std=c++0x -stdlib=libc++ ./unordered_set_class.cpp
In file included from ./unordered_set_class.cpp:2:
In file included from /usr/include/c++/v1/unordered_set:305:
In file included from /usr/include/c++/v1/__hash_table:16:
In file included from /usr/include/c++/v1/memory:589:
/usr/include/c++/v1/type_traits:787:14: error: implicit instantiation of
undefined template 'std::__1::hash<FlowGraph::Register>'
: public _Tp
^
/usr/include/c++/v1/type_traits:798:56: note: in instantiation of template
class 'std::__1::__is_empty1<std::__1::hash<FlowGraph::Register> >'
requested here
struct __libcpp_empty : public integral_constant<bool, sizeof(...
^
/usr/include/c++/v1/type_traits:802:63: note: in instantiation of template
class 'std::__1::__libcpp_empty<std::__1::hash<FlowGraph::Register>,
true>' requested here
..._Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {};
^
/usr/include/c++/v1/memory:1806:40: note: in instantiation of template class
'std::__1::is_empty<std::__1::hash<FlowGraph::Register> >' requested here
bool = is_empty<_T2>::value>
^
/usr/include/c++/v1/memory:1824:44: note: in instantiation of default argument
for '__libcpp_compressed_pair_switch<unsigned long,
std::__1::hash<FlowGraph::Register>, false, false>' required here
...class _T2, unsigned = __libcpp_compressed_pair_switch<_T1, _T2>::value>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/memory:2011:15: note: in instantiation of default argument
for '__libcpp_compressed_pair_imp<unsigned long,
std::__1::hash<FlowGraph::Register> >' required here
: private __libcpp_compressed_pair_imp<_T1, _T2>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__hash_table:501:55: note: in instantiation of template
class 'std::__1::__compressed_pair<unsigned long,
std::__1::hash<FlowGraph::Register> >' requested here
__compressed_pair<size_type, hasher> __p2_;
^
/usr/include/c++/v1/unordered_set:328:13: note: in instantiation of template
class 'std::__1::__hash_table<FlowGraph::Register,
std::__1::hash<FlowGraph::Register>,
std::__1::equal_to<FlowGraph::Register>,
std::__1::allocator<FlowGraph::Register> >' requested here
__table __table_;
^
./unordered_set_class.cpp:25:19: note: in instantiation of template class
'std::__1::unordered_set<FlowGraph::Register,
std::__1::hash<FlowGraph::Register>,
std::__1::equal_to<FlowGraph::Register>,
std::__1::allocator<FlowGraph::Register> >' requested here
RegisterSet _In;
^
/usr/include/c++/v1/memory:2509:29: note: template is declared here
template <class _Tp> struct hash;
^
/usr/include/c++/v1/memory:1806:55: error: no member named 'value' in
'std::__1::is_empty<std::__1::hash<FlowGraph::Register> >'
bool = is_empty<_T2>::value>
~~~~~~~~~~~~~~~^
/usr/include/c++/v1/memory:1824:44: note: in instantiation of default argument
for '__libcpp_compressed_pair_switch<unsigned long,
std::__1::hash<FlowGraph::Register>, false, false>' required here
...class _T2, unsigned = __libcpp_compressed_pair_switch<_T1, _T2>::value>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/memory:2013:13: note: in instantiation of default argument
for '__libcpp_compressed_pair_imp<unsigned long,
std::__1::hash<FlowGraph::Register> >' required here
typedef __libcpp_compressed_pair_imp<_T1, _T2> base;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__hash_table:501:55: note: in instantiation of template
class 'std::__1::__compressed_pair<unsigned long,
std::__1::hash<FlowGraph::Register> >' requested here
__compressed_pair<size_type, hasher> __p2_;
^
/usr/include/c++/v1/unordered_set:328:13: note: in instantiation of template
class 'std::__1::__hash_table<FlowGraph::Register,
std::__1::hash<FlowGraph::Register>,
std::__1::equal_to<FlowGraph::Register>,
std::__1::allocator<FlowGraph::Register> >' requested here
__table __table_;
^
./unordered_set_class.cpp:25:19: note: in instantiation of template class
'std::__1::unordered_set<FlowGraph::Register,
std::__1::hash<FlowGraph::Register>,
std::__1::equal_to<FlowGraph::Register>,
std::__1::allocator<FlowGraph::Register> >' requested here
RegisterSet _In;
^
In file included from ./unordered_set_class.cpp:2:
In file included from /usr/include/c++/v1/unordered_set:305:
In file included from /usr/include/c++/v1/__hash_table:16:
/usr/include/c++/v1/memory:2029:31: error: constructor cannot be redeclared
_LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
^
/usr/include/c++/v1/__hash_table:501:55: note: in instantiation of template
class 'std::__1::__compressed_pair<unsigned long,
std::__1::hash<FlowGraph::Register> >' requested here
__compressed_pair<size_type, hasher> __p2_;
^
/usr/include/c++/v1/unordered_set:328:13: note: in instantiation of template
class 'std::__1::__hash_table<FlowGraph::Register,
std::__1::hash<FlowGraph::Register>,
std::__1::equal_to<FlowGraph::Register>,
std::__1::allocator<FlowGraph::Register> >' requested here
__table __table_;
^
./unordered_set_class.cpp:25:19: note: in instantiation of template class
'std::__1::unordered_set<FlowGraph::Register,
std::__1::hash<FlowGraph::Register>,
std::__1::equal_to<FlowGraph::Register>,
std::__1::allocator<FlowGraph::Register> >' requested here
RegisterSet _In;
^
/usr/include/c++/v1/memory:2025:40: note: previous declaration is here
_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param ...
^
clang-3.0:
/home/ryuta/devel/llvm/src/llvm/tools/clang/include/clang/AST/DeclCXX.h:523:
const clang::CXXRecordDecl::DefinitionData& clang::CXXRecordDecl::data() const:
Assertion `DefinitionData && "queried property of class with no definition"'
failed.
Stack dump:
0. Program arguments: /usr/bin/clang-3.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
unordered_set_class.cpp -mrelocation-model static -mdisable-fp-elim
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-momit-leaf-frame-pointer -g -resource-dir /usr/bin/../lib/clang/3.0
-nostdinc++ -cxx-isystem /usr/include/c++/v1 -O0 -std=c++0x -fdeprecated-macro
-ferror-limit 19 -fmessage-length 79 -fcxx-exceptions -fexceptions
-fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-Dt9rrS.o
-x c++ ./unordered_set_class.cpp
1. ./unordered_set_class.cpp:25:22: current parser token ';'
2. ./unordered_set_class.cpp:4:1: parsing struct/union/class body
'FlowGraph'
clang-3: error: unable to execute command: Aborted
clang-3: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
--
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