https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114925
--- Comment #2 from fabian_kessler at gmx dot de <fabian_kessler at gmx dot de>
---
(In reply to Andrew Pinski from comment #1)
> I thought char8_t is still a character type so aliasing wise it falls under
> that rule.
Actually no. They are distinct types and only 4 types are allowed to alias
everything. That's char, signed/unsigned char and std::byte.
Consider the following function:
```
void cringe(char*& a, char8_t*& b){
b = u8"Hello There!"
print(a);
}
```
```
int main(){
char8_t* obiwan = u8"Kenobi";
cringe((char*&)obiwan, obiwan); // Might output "Kenobi" instead of "Hello
There!"
}
```
That is, because the compiler is allowed to assume, that b can't alias a and no
change can't happen to a in that function.