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

Jeffrey Walton noloader at gmail.com
Mon Jul 27 08:25:56 PDT 2015


On Mon, Jul 27, 2015 at 11:21 AM, Jeffrey Walton <noloader at gmail.com> wrote:
> 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

And here's part of the problem:

    $ c++ -x c++ -dM -E - < /dev/null | grep -i libcpp
    $

Like I said, Apple fiddles with things incessantly....

Jeff




More information about the cfe-dev mailing list