[LLVMbugs] [Bug 10218] New: __compressed_pair<int, int> does not compile
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jun 28 03:53:17 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10218
Summary: __compressed_pair<int, int> does not compile
Product: libc++
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
AssignedTo: hhinnant at apple.com
ReportedBy: jonathan.sauer at gmx.de
CC: llvmbugs at cs.uiuc.edu
The following applies to a class internal to libc++; I stumbled upon it while
narrowing down Bug 10191. Still, I thought it might be useful to report it:
template <class _T1, class _T2>
class __libcpp_compressed_pair_imp
{
public:
typedef _T1 _T1_param;
typedef _T2 _T2_param;
__libcpp_compressed_pair_imp();
__libcpp_compressed_pair_imp(_T1_param __t1, int = 0);
__libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2);
};
int main(int, char**)
{
__libcpp_compressed_pair_imp<int, int> f;
}
I isolated this code from the __compressed_pair implementation in <memory>.
When compiling with clang r133996, the following error is generated:
clang.cpp:10:2: error: constructor cannot be redeclared
__libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2);
^
clang.cpp:16:41: note: in instantiation of template class
'__libcpp_compressed_pair_imp<int, int>'
requested here
__libcpp_compressed_pair_imp<int, int> f;
^
clang.cpp:9:5: note: previous declaration is here
__libcpp_compressed_pair_imp(_T1_param __t1, int = 0);
^
1 error generated.
This is because <int> is used both as a way to distinguish between the
constructor for <_T1> and <_T2> as well as <_T2> itself, effectively making
lines A and identical.
I think a private type should be used for the dummy parameters instead of <int>
(if the bug is considered relevant, that is).
I'm using libc++ r133667.
--
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