re PR c/44772 (-Wc++-compat warns incorrectly for anonymous unions)
PR c/44772 * c-decl.c (warn_cxx_compat_finish_struct): Don't call pointer_set_contains if DECL_NAME is NULL. * gcc.dg/Wcxx-compat-21.c: New test. From-SVN: r166384
This commit is contained in:
parent
c3928dde21
commit
a75de69230
4 changed files with 38 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/44772
|
||||
* c-decl.c (warn_cxx_compat_finish_struct): Don't call
|
||||
pointer_set_contains if DECL_NAME is NULL.
|
||||
|
||||
2010-11-05 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
PR target/46084
|
||||
|
|
|
@ -6877,7 +6877,8 @@ warn_cxx_compat_finish_struct (tree fieldlist)
|
|||
|
||||
for (x = fieldlist; x != NULL_TREE; x = DECL_CHAIN (x))
|
||||
{
|
||||
if (pointer_set_contains (tset, DECL_NAME (x)))
|
||||
if (DECL_NAME (x) != NULL_TREE
|
||||
&& pointer_set_contains (tset, DECL_NAME (x)))
|
||||
{
|
||||
warning_at (DECL_SOURCE_LOCATION (x), OPT_Wc___compat,
|
||||
("using %qD as both field and typedef name is "
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2010-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/44772
|
||||
* gcc.dg/Wcxx-compat-21.c: New test.
|
||||
|
||||
2010-11-05 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
PR target/46084
|
||||
|
|
25
gcc/testsuite/gcc.dg/Wcxx-compat-21.c
Normal file
25
gcc/testsuite/gcc.dg/Wcxx-compat-21.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* PR c/44772 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wc++-compat" } */
|
||||
|
||||
typedef enum { E1, E2 } E;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
E e;
|
||||
union
|
||||
{
|
||||
int i;
|
||||
char *c;
|
||||
}; /* { dg-bogus "as both field and typedef name" } */
|
||||
} S;
|
||||
|
||||
S s;
|
||||
|
||||
typedef int T;
|
||||
|
||||
struct U
|
||||
{
|
||||
T t;
|
||||
union { int i; }; /* { dg-bogus "as both field and typedef name" } */
|
||||
};
|
Loading…
Add table
Reference in a new issue