Another short comment about this, adding a virtual destructor also keeps the segmentation fault from occurring.<br><br><div class="gmail_quote">On Sat, Nov 13, 2010 at 11:41 AM, William Lynch <span dir="ltr"><<a href="mailto:wlynch@wlynch.cx">wlynch@wlynch.cx</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<div><br></div><div>I was on stackoverflow when I came across this question: <a href="http://stackoverflow.com/questions/4173107/llvm-gcc-stdallocator-bug" target="_blank">http://stackoverflow.com/questions/4173107/llvm-gcc-stdallocator-bug</a>. It's causing a segmentation fault when compiled with llvm-g++ but not when compiled with g++. It also works under OS X but not under Ubuntu 10.10.</div>

<div><br></div><div>I've reduced a test case down to the following:</div><div><br></div><div><div>#include <vector></div><div><br></div><div>struct blub {};</div><div>struct intvec : public std::vector<int>, public blub {};</div>

<div><br></div><div>int main() {</div><div>    intvec d;</div><div>    intvec e(d);</div><div>}</div></div><div><br></div><div>The last interesting comment is that if I add the following copy constructor (as well as a default constructor), it works:</div>

<div><br></div><div><div>    intvec(const intvec & other) : std::vector<int>(other)</div><div>    {}</div><div><br></div></div><div>If I add this copy constructor (and the same default constructor), it will still seg fault.</div>

<div><br></div><div><div>    intvec(const intvec & other) : std::vector<int>(other), blub(other)</div><div>    {}</div><div><br></div></div><div><br></div><div>Anyone have any ideas about this?</div>
<div>Thanks,</div><div>Bill Lynch</div>
</blockquote></div><br>