[Bug debug/102978] New: Function/Struct declaration with absent semicolon that is put before including standard header results in wall of errors with no indication of the actual problem
konstantinua00 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Oct 28 03:36:21 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102978
Bug ID: 102978
Summary: Function/Struct declaration with absent semicolon that
is put before including standard header results in
wall of errors with no indication of the actual
problem
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: konstantinua00 at gmail dot com
Target Milestone: ---
```
void foo()
#include <any_std_header>
```
or
```
struct bar
#include <any_std_header>
```
as stated, give many useless errors.
example with <bitset>: https://godbolt.org/z/KbrrszEWr
less intimidating example with <cstddef>: https://godbolt.org/z/hxnxzqTcW
example with struct declaration: https://godbolt.org/z/nhTKc8cM9
happens in GCC with C std header too: https://godbolt.org/z/c6hMWexcW
Such situation happens when there're 2 user headers: first with missing
semicolon and second with new-in-TU std header.
G++(but not GCC) already notices missing semicolon on struct definitions and
GCC (but not G++) notices globals without one (due to typedef
https://godbolt.org/z/44oYT1PKn), so maybe something can be done for
declarations too?
More information about the Gcc-bugs
mailing list