llvm / llvm/llvm-project

[libc++] Declarations of `error_condition` and `path::iterator` cause issues with visibility pragmas

Open
#180,679 3 comments 0 reactions 0 assignees View on GitHub
libc++ regression:21
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://github.com/llvm/llvm-project/pull/132602 removed visibility attributes from certain declarations (`error_condition` and `filesystem::path::iterator`). This creates an inconsistency between the declaration and the definition (which still has the attribute) if a user changes the default visibility via a pragma. The following code demonstrates both of these issues ([Godbolt](https://godbolt.org/z/48z454dn5)):
```cpp
#pragma GCC visibility push(hidden)
#include
```

```
<...>/error_condition.h:49:7: error: visibility does not match previous declaration
49 | class _LIBCPP_EXPORTED_FROM_ABI error_condition {
| ^

<...>/path_iterator.h:26:7: error: visibility does not match previous declaration
26 | class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
| ^
```

While this pragma is a non-standard extension, it seems like supporting it is rather easy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.