diff options
author | Marek Polacek <polacek@redhat.com> | 2019-11-08 21:48:47 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-11-08 21:48:47 +0000 |
commit | 65471f09e9f0b192927ca980c2676044209adbba (patch) | |
tree | 6d694656d3c7fcabd191af27068af367ce3d3dd9 /gcc/tree.c | |
parent | a2dbbda892ac9e26fd7ebf6167363c58e5ed726b (diff) | |
download | gcc-65471f09e9f0b192927ca980c2676044209adbba.zip gcc-65471f09e9f0b192927ca980c2676044209adbba.tar.gz gcc-65471f09e9f0b192927ca980c2676044209adbba.tar.bz2 |
PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
I noticed that for code like
struct S {
int *foo : 3;
};
we generate nonsensical
r.C:2:8: error: function definition does not declare parameters
2 | int *foo : 3;
It talks about a function because after parsing the declspecs of 'foo' we don't
see either ':' or "name :", so we think it's not a bit-field decl. So we parse
the declarator and since a ctor-initializer begins with a ':', we try to parse
it as a function body, generating the awful diagnostic. With this patch, we
issue:
r.C:2:8: error: bit-field ‘foo’ has non-integral type ‘int*’
2 | int *foo : 3;
* parser.c (cp_parser_member_declaration): Add a diagnostic for
bit-fields with non-integral types.
* g++.dg/diagnostic/bitfld4.C: New test.
From-SVN: r277991
Diffstat (limited to 'gcc/tree.c')
0 files changed, 0 insertions, 0 deletions