Malformed warning message under macro expansion
- Dominant language
- C++
- Stars
- 3k
- Forks
- 352
- PR merge metrics
- No merged PRs in 30d
Description
```c
int foo(varying int a, int c) {
return a |= c;
}
enum E {
E1 = 10,
E2 = 20,
};
#define M(x) x = foo(x, (int)E2);
int warn2(varying int a) {
return M(a);
}
```
Warning message contains only unexpanded source code whereas carets point to expanded columns. In case of nested or big macros, it is hard to understand what is really going wrong especially when only types (not variable names) are printed.
```bash
:11:23: Warning: Typecasting to type "/*unbound*/ int32"
(variability not specified) from "uniform" type "const uniform enum E"
results in "uniform" variability.
In the context of function argument it may lead to unexpected
behavior. Casting to "uniform int32" is recommended.
return M(a);
^^^^^^^
Compiler returned: 0
```
compiler explorer: https://godbolt.org/z/zahEzYo9s
Contributor guide
Assessment
This issue has not been assessed yet.