| Issue |
164068
|
| Summary |
Default equality operator for an empty union cannot be used in constant expressions
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Fedr
|
This program
```c++
union U {
constexpr bool operator ==(const U&) const = default;
};
static_assert( U{} == U{} );
```
is accepted in GCC and EDG. But Clang fails with the error:
```
<source>:5:16: error: static assertion _expression_ is not an integral constant _expression_
5 | static_assert( U{} == U{} );
| ^~~~~~~~~~
<source>:5:16: note: pointer to temporary is not a constant _expression_
<source>:5:16: note: temporary created here
```
Online demo: https://gcc.godbolt.org/z/MMrbaaWae
Related discussion: https://stackoverflow.com/q/79793373/7325599
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs