[cfe-dev] Using unique_ptr in both C++03 and C++11 mode?

Jeffrey Walton noloader at gmail.com
Mon Jul 27 08:21:57 PDT 2015


On Mon, Jul 27, 2015 at 10:55 AM, Jeffrey Walton <noloader at gmail.com> wrote:
>>>>> Why are you trying to special-case __APPLE__ at all?  You might want to have different things for libstdc++ / libc++, but that’s not an Apple/everyone else distinction.
>>>>
>>>> Because Apple fiddles with things. I.e., its broke without the Apple
>>>> defines, too.
>>>
>>> Do you have test cases for this?  I’ve not encountered any problems moving C++ code between OS X and FreeBSD, the only time I need portability #defines is when I also want to move it to a platform where libstdc++ is the default C++ standard library implementation.
>>>
>>
>> Well, I'm kind of suffering one as we speak :)
>>
>> What would you like me to submit?
>
> I think these are the four test cases. Two of them fail...
>
>  * c++ -c test-clapple.cxx
>     * OK
>  * c++ -stdlib=libc++ -c test-clapple.cxx
>     * FAIL
>  * c++ -std=c++11 -c test-clapple.cxx
>     * FAIL
>  * c++ -std=c++11 -stdlib=libc++ -c test-clapple.cxx
>     * OK

By the way, here are my test results:

// c++ -c test-clapple.cxx
//     - OK
// c++ -stdlib=libc++ -c test-clapple.cxx
//     - FAILS, 'tr1/memory' not found
// c++ -std=c++11 -c test-clapple.cxx
//     - FAILS, no type named 'unique_ptr' in namespace 'std'
// c++ -std=c++11 -stdlib=libc++ -c test-clapple.cxx
//     - OK

The reason this is a problem for us is auto_ptr is deprecated in
C++11. Our engineering process requires a clean compile with -Wall
-Wextra as a security gate. So we can't pass through the gate until we
sort this out....

(And we don't do things like masking warnings we don't feel like managing).




More information about the cfe-dev mailing list