Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: no template named '__vector_base' in namespace 'std' #1867

Closed
yurivict opened this issue Sep 26, 2022 · 2 comments
Closed

error: no template named '__vector_base' in namespace 'std' #1867

yurivict opened this issue Sep 26, 2022 · 2 comments

Comments

@yurivict
Copy link
Contributor

In file included from /disk-samsung/freebsd-ports/devel/folly/work/folly-2022.09.26.00/folly/memory/test/UninitializedMemoryHacksTest.cpp:17:
/disk-samsung/freebsd-ports/devel/folly/work/folly-2022.09.26.00/folly/memory/UninitializedMemoryHacks.h:302:23: error: no template named '__vector_base' in namespace 'std'
    using Base = std::__vector_base<T, std::allocator<T>>;
                 ~~~~~^

Where is std::__vector_base specified?
https://en.cppreference.com/ doesn't have any information about it.

Version: 2022.09.26.00
FreeBSD 13.1

@Orvid
Copy link
Contributor

Orvid commented Oct 10, 2022

It used to be defined in <vector> when using libc++, but it looks like newer versions of libc++ don't have it, so that bit of code will need to be reworked in order to build against the newer libc++ :(

yfeldblum added a commit to yfeldblum/folly that referenced this issue Jan 11, 2023
Summary:
The `std::__vector_base` class in libc++ is removed in libc++ 15 (llvm/llvm-project@b82da8b). So the two current implementations of the hacks - the implementation for libc++ 14 and the implementation for earlier libc++ - both fail.

Even with libc++ 14, which retains `std::__vector_base`, Xcode 14 fails to compile the hacks:

```
In file included from folly/memory/test/UninitializedMemoryHacksODR.cpp:17:
folly/memory/UninitializedMemoryHacks.h:461:1: error: conversion from 'std::__vector_base<char, std::allocator<char>>::pointer std::__vector_base<char, std::allocator<char>>::*' to 'char *std::vector<char>::*' is not allowed in a converted constant expression
FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT(char)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
folly/memory/UninitializedMemoryHacks.h:327:7: note: expanded from macro 'FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT'
      &std::vector<TYPE>::__end_,                                    \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
...
```

Since libc++ is unlikely to change the internal layout of `std::vector` on a cadence which is too frequent for folly, we can use a layout struct rather than a template instance for the hacks and have it work for a range of versions of libc++ and Xcode.

Closes: facebook#1867.

Differential Revision: D42459219

fbshipit-source-id: cce2a1e4b8ba5791061cbe9f313cb33bee058fa3
@yfeldblum
Copy link
Contributor

@yurivict Would you be able to test #1912?

yfeldblum added a commit to yfeldblum/folly that referenced this issue Jan 14, 2023
Summary:
Pull Request resolved: facebook#1912
Closes: facebook#1867

The `std::__vector_base` class in libc++ is removed in libc++ 15 (llvm/llvm-project@b82da8b). So the two current implementations of the hacks - the implementation for libc++ 14 and the implementation for earlier libc++ - both fail.

Even with libc++ 14, which retains `std::__vector_base`, Xcode 14 fails to compile the hacks:

```
In file included from folly/memory/test/UninitializedMemoryHacksODR.cpp:17:
folly/memory/UninitializedMemoryHacks.h:461:1: error: conversion from 'std::__vector_base<char, std::allocator<char>>::pointer std::__vector_base<char, std::allocator<char>>::*' to 'char *std::vector<char>::*' is not allowed in a converted constant expression
FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT(char)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
folly/memory/UninitializedMemoryHacks.h:327:7: note: expanded from macro 'FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT'
      &std::vector<TYPE>::__end_,                                    \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
...
```

Since libc++ is unlikely to change the internal layout of `std::vector` on a cadence which is too frequent for folly - any material change would be an ABI break -, we can use a layout struct rather than a template instance for the hacks and have it work for a range of versions of libc++ and Xcode.

Reviewed By: simpkins, swolchok

Differential Revision: D42459219

fbshipit-source-id: 379b86055601e5cc166a4d3364ab8d10be86f001
facebook-github-bot pushed a commit to facebook/hhvm that referenced this issue Jan 14, 2023
Summary:
X-link: facebook/folly#1912
Closes: facebook/folly#1867

The `std::__vector_base` class in libc++ is removed in libc++ 15 (llvm/llvm-project@b82da8b). So the two current implementations of the hacks - the implementation for libc++ 14 and the implementation for earlier libc++ - both fail.

Even with libc++ 14, which retains `std::__vector_base`, Xcode 14 fails to compile the hacks:

```
In file included from folly/memory/test/UninitializedMemoryHacksODR.cpp:17:
folly/memory/UninitializedMemoryHacks.h:461:1: error: conversion from 'std::__vector_base<char, std::allocator<char>>::pointer std::__vector_base<char, std::allocator<char>>::*' to 'char *std::vector<char>::*' is not allowed in a converted constant expression
FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT(char)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
folly/memory/UninitializedMemoryHacks.h:327:7: note: expanded from macro 'FOLLY_DECLARE_VECTOR_RESIZE_WITHOUT_INIT'
      &std::vector<TYPE>::__end_,                                    \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
...
```

Since libc++ is unlikely to change the internal layout of `std::vector` on a cadence which is too frequent for folly - any material change would be an ABI break -, we can use a layout struct rather than a template instance for the hacks and have it work for a range of versions of libc++ and Xcode.

Reviewed By: simpkins, swolchok

Differential Revision: D42459219

fbshipit-source-id: e23ef383869681b5c81e4301114020b9089c7461
carlocab added a commit to carlocab/homebrew-core that referenced this issue Jun 15, 2023
Also:

- deprecate, because it vendors an ancient version of folly that no
  longer works with newer versions of libc++. See facebook/folly#1867.
- remove Ventura bottles, because they will fail to build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants