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
+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
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 "
+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
--- /dev/null
+/* 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" } */
+};