| Issue |
109776
|
| Summary |
clang's bad register type error points to register keyword instead of type name
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
DavidSpickett
|
Reported / discovered by https://discourse.llvm.org/t/frontend-how-to-use-register-union-or-struct-in-c/81392.
https://godbolt.org/z/fx6M7KrW9
```
typedef union Test {
int i;
} Test;
register Test t asm ("x21");
```
Errors with:
```
<source>:5:22: error: size of register 'x21' does not match variable size
5 | register Test t asm ("x21");
| ^
<source>:5:1: error: bad type for named register variable
5 | register Test t asm ("x21");
| ^
2 errors generated.
Compiler returned: 1
```
The second error:
```
<source>:5:1: error: bad type for named register variable
5 | register Test t asm ("x21");
| ^
```
Points to the storage specifier not to the type name, which is confusing if you are not laser focused on the exact meaning of "type" here.
It should be:
```
<source>:5:1: error: bad type for named register variable
5 | register Test t asm ("x21");
| ^
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs