Issue |
93393
|
Summary |
libclang 18.1.6 doesn't identify an implicit cast to int from a boolean _expression_ when used inside of an init list
|
Labels |
new issue
|
Assignees |
|
Reporter |
f-cozzocrea
|
When analysing C code, libclang isn't identifying an implicit cast from a boolean _expression_ to an int field of a struct when the _expression_ is inside of an init list. Here's a minimal example:
```C
typedef struct {
int a;
} bar_t;
bar_t test_bool(int b) {
return (bar_t){.a = b != 0};
}
```
In this example, calling `getStmtClass()` on the _expression_ `.a = b != 0` returns the value `BinaryOperator`, when it should return `ImplicitCastExpr`.
libclang's `getStmtClass()` correctly returns `ImplicitCastExpr` when the _expression_ is a field access instead of an init list. eg.
```C
bar_t test_bool(int b) {
bar_t x;
x.a = b !=0; // <-- ImplicitCastExpr correctly identified here
return x;
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs