Issue |
123815
|
Summary |
[c++][Modules] Member variable of non-exported type has inaccessible hidden friend with defaulted comparison
|
Labels |
new issue
|
Assignees |
|
Reporter |
davidstone
|
The following valid translation units
```c++
export module a;
namespace n {
}
```
```c++
export module b;
import a;
namespace n {
struct monostate {
friend bool operator==(monostate, monostate) = default;
};
export struct wrapper {
friend bool operator==(wrapper const &, wrapper const &) = default;
monostate m_value;
};
} // namespace n
```
```c++
import b;
static_assert(n::wrapper() == n::wrapper());
```
are rejected by clang with
```console
In file included from /app/c.cpp:1:
b.cpp:12:67: error: invalid operands to binary _expression_ ('const monostate' and 'const monostate')
12 | friend bool operator==(wrapper const &, wrapper const &) = default;
| ^
c.cpp:3:28: note: in defaulted equality comparison operator for 'wrapper' first required here
3 | static_assert(n::wrapper() == n::wrapper());
| ^
c.cpp:3:28: error: static assertion _expression_ is not an integral constant _expression_
3 | static_assert(n::wrapper() == n::wrapper());
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
2 errors generated.
```
See it live: https://godbolt.org/z/19dG3G7Pb
Introduced by c5e4afe6733c58e24023ede04275bbed3bde8240 @ChuanqiXu9
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs