Date: Wed, 13 Nov 2013 17:59:39 +1030 From: Shane Ambler <FreeBSD@ShaneWare.Biz> To: Tijl Coosemans <tijl@coosemans.org>, Steve Kargl <sgk@troutmask.apl.washington.edu> Cc: Dimitry Andric <dim@FreeBSD.org>, freebsd-current@FreeBSD.org, David Chisnall <theraven@FreeBSD.org> Subject: Re: Are clang++ and libc++ compatible? Message-ID: <52832A63.1000601@ShaneWare.Biz> In-Reply-To: <20131112221946.78602db0@kalimero.tijl.coosemans.org> References: <20131112163219.GA2834@troutmask.apl.washington.edu> <77CB2B92-216A-4C80-B033-7E582B5F0DFC@FreeBSD.org> <20131112165422.GA2939@troutmask.apl.washington.edu> <E0FE40D9-726C-4501-B31A-3622510C1C68@FreeBSD.org> <20131112175556.GA3319@troutmask.apl.washington.edu> <20131112201922.GA4330@troutmask.apl.washington.edu> <20131112221946.78602db0@kalimero.tijl.coosemans.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 13/11/2013 07:49, Tijl Coosemans wrote:
> On Tue, 12 Nov 2013 12:19:22 -0800 Steve Kargl wrote:
>> On Tue, Nov 12, 2013 at 09:55:56AM -0800, Steve Kargl wrote:
>>> On Tue, Nov 12, 2013 at 06:37:39PM +0100, Dimitry Andric wrote:
>>>> On 12 Nov 2013, at 17:54, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
>>>>>
>>>>> struct Entry {
>>>>> time_t date;
>>>>> Severity severity;
>>>>> std::deque<Entry> messages;
>>>>> std::string message;
>>>>> bool is_child;
>>>>> Entry() : is_child(false) { }
>>>>> };
>>>>
>>>> I think the problem is that the code tries to use std::deque<Entry> as a
>>>> member of struct Entry, before it is completely defined. This is not
>>>> allowed by the standard, although some libraries (e.g. GNU libstdc++)
>>>> apparently permit it for some container types.
> There's a similar problem with graphics/blender. There's a class
> TreeElement which links to its parent TreeElement like this:
>
> std::map<std::string, TreeElement>::const_iterator parent;
>
> Works with libstdc++, fails with libc++. If the standard doesn't
> specify this it would still be a very convenient extension.
>
A possible solution I found looking into this is to wrap the Entry
reference in a std::unique_ptr - so changing -
std::deque<Entry> messages;
to -
std::deque<std::unique_ptr<Entry>> messages;
This turns messages into a pointer so you need to change
messages.date into messages->date
This got blender compiling past that issue but I haven't got the rest
of it compiling to test that it runs.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52832A63.1000601>
