+2019-08-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * c-decl.c (finish_enum): Clear C_TYPE_BEING_DEFINED.
+
2019-08-08 Jakub Jelinek <jakub@redhat.com>
* c-typeck.c (c_finish_omp_clauses): For C_ORT_OMP
&& !in_sizeof && !in_typeof && !in_alignof)
struct_parse_info->struct_types.safe_push (enumtype);
+ C_TYPE_BEING_DEFINED (enumtype) = 0;
+
return enumtype;
}
+2019-08-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/pr79983.c (enum E): Don't allow an error about nested
+ definitions.
+ * gcc.dg/enum-redef-1.c: New test.
+
2019-08-08 Marek Polacek <polacek@redhat.com>
PR c++/87519 - bogus warning with -Wsign-conversion.
--- /dev/null
+enum a { A };
+enum a { B }; /* { dg-bogus "nested redefinition" } */
+/* { dg-error "redeclaration of 'enum a'" "" { target *-*-* } .-1 } */
+
+enum empty {}; /* { dg-error "empty enum is invalid" } */
+enum empty {}; /* { dg-bogus "nested redefinition" } */
+/* { dg-error "empty enum is invalid" "" { target *-*-* } .-1 } */
+
+enum nested_first {
+ C1 = sizeof(enum nested_first { C1a }), /* { dg-error "nested redefinition of 'enum nested_first" } */
+ C2 = sizeof(enum nested_first { C2a }) /* { dg-error "redeclaration of 'enum nested_first'" "" } */
+};
+
+enum nested_second {
+ D1,
+ D2 = sizeof(enum nested_second { D2a }), /* { dg-error "nested redefinition of 'enum nested_second" } */
+ D3 = sizeof(enum nested_second { D3a }) /* { dg-error "redeclaration of 'enum nested_second'" "" } */
+};
+
+enum nested_repeat { E };
+enum nested_repeat { /* { dg-error "redeclaration of 'enum nested_repeat'" "" } */
+ F = sizeof(enum nested_repeat { Fa }) /* { dg-error "nested redefinition of 'enum nested_repeat" } */
+};
+
+enum nested_empty {
+ G1 = sizeof(enum nested_empty {}), /* { dg-error "nested redefinition of 'enum nested_empty" } */
+ /* { dg-error "empty enum is invalid" "" { target *-*-* } .-1 } */
+ G2 = sizeof(enum nested_empty { G2a })
+};
enum E;
enum E { A, B, C }; /* { dg-message "originally defined here" } */
-enum E { D, F }; /* { dg-error "nested redefinition of 'enum E'|redeclaration of 'enum E'" } */
+enum E { D, F }; /* { dg-error "redeclaration of 'enum E'" } */
union U;
union U { int i; }; /* { dg-message "originally defined here" } */