Objective-C ++ ARC и C ++ контейнеры

Я пытаюсь скомпилировать свой устаревший проект libFoundation, расположенный по адресу https://github.com/chmeeedalf/lf-foundation но сталкиваюсь с проблемами при использовании clang 3.4 и libc ++. Кажется, что-то не устраивает ARC в контейнерах, и я вижу следующую ошибку:

In file included from /home/chmeee/git-lffoundation/src/Collections/NSCoreArray.mm:34:
In file included from /home/chmeee/git-lffoundation/src/../Headers/Foundation/NSArray.h:31:
In file included from /home/chmeee/git-lffoundation/src/../Headers/Foundation/NSObject.h:40:
In file included from /home/chmeee/git-lffoundation/src/../Headers/Foundation/NSRange.h:192:
In file included from /usr/include/c++/v1/algorithm:627:
/usr/include/c++/v1/memory:913:17: error: call to 'addressof' is ambiguous
{return _VSTD::addressof(__r);}
^~~~~~~~~~~~~~~~
/usr/include/c++/v1/__config:341:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
^
/usr/include/c++/v1/vector:1678:65: note: in instantiation of member function 'std::__1::pointer_traits<const __strong id *>::pointer_to' requested here
const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
^
/home/chmeee/git-lffoundation/src/Collections/NSCoreArray.mm:115:8: note: in instantiation of member function 'std::__1::vector<id, std::__1::allocator<id> >::insert' requested here
items.insert(items.begin() + index, anObject);
^
/usr/include/c++/v1/__functional_base:96:1: note: candidate function [with _Tp = const id]
addressof(__strong _Tp& __x) _NOEXCEPT
^
/usr/include/c++/v1/__functional_base:122:1: note: candidate function [with _Tp = const id]
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
^
/usr/include/c++/v1/__functional_base:83:1: note: candidate function [with _Tp = const id]
addressof(_Tp& __x) _NOEXCEPT
^
1 error generated.
*** Error code 1

Stop.
make: stopped in /home/chmeee/git-lffoundation/src
Exit 1

Файл в этом примере имеет std::vector объявлен как:

    std::vector<id> items;

Может кто-нибудь пролить свет на эту проблему? Я попытался добавить явное __strong в std::vector декларация, но безрезультатно __unsafe_unretained устраняет ошибку

Я строю на FreeBSD -CURRENT, используя libc ++ и clang 3.4, которые есть в базе.

1

Решение

Отвечая на мой собственный вопрос, на случай, если другие заинтересуются. Clang определяет __weak в качестве макроса препроцессора для ARC. Тем не менее, FreeBSD <sys/cdefs.h> также определяет __weak сам. Обходной путь, который я нашел для этого, должен был добавить к моему местному <sys/cdefs.h>:

#ifndef __weak
#define __weak what_freebsd_defines_ass
#endif
0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector