Issue 134372
Summary Improvement: better diagnostics for undefined behavior
Labels new issue
Assignees
Reporter pmor13
    Compiling this code:
```
void foo(void)
{
 struct x* y;
    *y;
}
```
with `-O3 -std=c11 -pedantic -Wall -Wextra` leads to:
```
<source>:4:5: error: incomplete type 'struct x' where a complete type is required
    4 |     *y;
```
For people who learned C11 by reading C11 this diagnostic may be confusing because C11 does not require the operand of the unary `*` operator to be pointer type, which points to an object of a complete type.

Expected diagnostics:
```
<source>:4:5: error: lvalue conversion: lvalue has an incomplete type
    4 | *y;
```
@AaronBallman 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to