Thanks for the response.<div><br></div><div>Yes, that compiles. Is there a reason that keeping the const doesn't work? Given that you say this isn't allowed, why is it a bad idea? The shared_ptr provided by boost takes this.</div>
<div><br></div><div>I did some more digging in the Buzilla (I had only searched open bugs before), and found this one: <a href="http://llvm.org/bugs/show_bug.cgi?id=8421">http://llvm.org/bugs/show_bug.cgi?id=8421</a> . It looks like the same thing, but in std::map instead. Also since emailing the list, I tried it in Visual Studio 2010 and it compiled without errors. However, I have no idea how to work Visual Studio, so some the settings may have been very different.</div>
<div><br></div><div>Thanks again,</div><div>Paul O'Neil<br><br><div class="gmail_quote">On Sun, Jan 1, 2012 at 8:12 PM, David Keller <span dir="ltr"><<a href="mailto:david.keller@litchis.fr">david.keller@litchis.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>You may write:</div><div><br><blockquote type="cite"><div>std::shared_ptr<const int> ptr(new <font color="#00bf1a">int</font>(4));</div>
</blockquote></div><div><br></div><div>Regards</div><div><br><div><div><div class="h5"><div>On Dec 30, 2011, at 1:29 AM, <a href="mailto:redballoon36@gmail.com" target="_blank">redballoon36@gmail.com</a> wrote:</div><br>
</div>
</div><blockquote type="cite"><div><div class="h5">Hello,<div><br></div><div>I've encountered a compiler error using shared_ptr and allocator from the libc++ header <memory>. I'm running OS X 10.7.2, and I first noticed this while using the libc++ implementation with Xcode 4.2.1, though I believe this still exists in svn 147357.</div>
<div><br></div><div>The problem is caused by instantiating std::allocator<> (in the memory header) with a const type. This causes the pointer and const_pointer types to be the same, which results in methods using these to have the same signatures, which gives a compiler error (as it should, given that methods are colliding). Is this supposed to happen? I haven't read the standard, but it seems like it should work, that is, that std::allocator<const int> should be allowed to exist.</div>
<div><br></div><div>A bit of background. This gets triggered when using:</div><div>std::shared_ptr<const int> ptr(new <font color="#c63529">const int</font>(4));</div><div>which also seems like a reasonable thing to do.</div>
<div><br></div><div>
Thanks,</div><div>Paul O'Neil</div></div></div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div></blockquote></div><br></div>