[LLVMbugs] [Bug 15576] New: vector<T1, allocator<T2>> fails to compile
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 23 03:05:10 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15576
Bug ID: 15576
Summary: vector<T1, allocator<T2>> fails to compile
Product: libc++
Version: 3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: hhinnant at apple.com
Reporter: tim at klingt.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
this code fails to compile with a rather obscure error message in v[0]:
```
#include <vector>
using namespace std;
vector<size_t, allocator<int>> v;
int main()
{
v.push_back(0);
v[0];
return 0;
}
```
gcc/libstdc++ accept this code, though. iac, i'd suggest one of two
workarounds:
* rebind the allocator to the type of the vector
* add a static assertion that (Alloc::value_type == vector::value_type). this
should simplify finding this kind of issues where they appear
--
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/20130323/473b104e/attachment.html>
More information about the llvm-bugs
mailing list