Re: C++ code compiles with libstdc++ but not libc++
Re: C++ code compiles with libstdc++ but not libc++
- Subject: Re: C++ code compiles with libstdc++ but not libc++
- From: Howard Hinnant <email@hidden>
- Date: Tue, 02 Oct 2012 12:18:08 -0400
On Oct 2, 2012, at 12:11 PM, Marshall Clow <email@hidden> wrote:
> On Oct 2, 2012, at 8:48 AM, Jean-Denis MUYS <email@hidden> wrote:
>
>> Hi,
>>
>> I am working on a rather large C++ library that has been ported to iOS some time ago against GCC and libstd++. I want to migrate it to LLVM 4.1 and libc++.
>>
>> I am currently failing on the "!=" operator on the second line there:
>>
>> for(KVector<HWND>::iterator iterColHwndLog = colHwndLog.begin()
>> ;iterColHwndLog != colHwndLog.end()
>> ;++iterColHwndLog
>> )
>>
>>
>> The error message is:
>>
>> Use of overloaded operator '!=' is ambiguous (with operand types 'KVector<HWND>::iterator' (aka '__wrap_iter<pointer>') and 'iterator' (aka '__wrap_iter<pointer>'))
>>
>> Note the "aka"'s are the same and the actual type differ only by their scope.
>
> There's more to this than what you're telling us.
>
> I dropped your code into a command-line tool (attached), and compiled it successfully.
>
> $ clang++ junk.cpp
> $ clang++ junk.cpp -std=c++11
> $ clang++ junk.cpp -std=c++11 -stdlib=libc++
> $ clang++ --version
> Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
> Target: x86_64-apple-darwin12.2.0
> Thread model: posix
>
> -- Marshall
>
> <junk.cpp>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
It is this:
template< class T >
inline bool
operator!=( const T& x, const T& y )
{
return !( x == y );
}
that is the trouble maker.
Howard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden