| Issue |
168724
|
| Summary |
CppCon performance not quite true?
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
kelbon
|
It strange issue, but there are CppCon video about libc++ shipped with clang:
https://www.youtube.com/watch?v=iw8hqKftP4I
And in first 9 minutes speaker says, that this code should compile on clang with libc++:
```cpp
template<typename V, typename E>
struct EX {
union U {
[[no_unique_address]] V v;
[[no_unique_address]] E e;
};
[[no_unique_address]] U u_;
bool has_val_;
};
struct mystruct {
int x;
bool y;
char z;
};
static_assert(sizeof(EX<mystruct, int>) == 8); // 12 in reality
```
But its not. Sizeof == 8, and i agree with compiler here
I also checked with std::expected itself:
```cpp
#include <expected>
struct mystruct {
int x;
bool y;
char z;
};
mystruct foo();
std::expected<mystruct, int> compute() {
return foo();
}
static_assert(sizeof(std::expected<mystruct, int>) == 12); // again, 12
```
https://godbolt.org/z/jPfbMqchW
A talk generally good, but this first part (9 minutes) confuses me.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs