File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
regression/ansi-c/struct8 Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ struct a ;
2+ union a b ;
Original file line number Diff line number Diff line change 1+ CORE test-c++-front-end
2+ main.c
3+
4+ ^EXIT=(64|1)$
5+ ^SIGNAL=0$
6+ redefinition of '(struct )?a' as different kind of tag
7+ ^CONVERSION ERROR$
8+ --
9+ Invariant check failed
Original file line number Diff line number Diff line change @@ -847,6 +847,13 @@ void c_typecheck_baset::typecheck_compound_type(struct_union_typet &type)
847847 symbol_table.get_writeable_ref (s_it->first ).type .swap (type);
848848 }
849849 }
850+ else if (s_it->second .type .id () != type.id ())
851+ {
852+ error ().source_location = type.source_location ();
853+ error () << " redefinition of '" << s_it->second .pretty_name << " '"
854+ << " as different kind of tag" << eom;
855+ throw 0 ;
856+ }
850857 else if (have_body)
851858 {
852859 error ().source_location =type.source_location ();
Original file line number Diff line number Diff line change @@ -212,6 +212,13 @@ void cpp_typecheckt::typecheck_compound_type(
212212 throw 0 ;
213213 }
214214 }
215+ else if (symbol.type .id () != type.id ())
216+ {
217+ error ().source_location = type.source_location ();
218+ error () << " redefinition of '" << symbol.pretty_name << " '"
219+ << " as different kind of tag" << eom;
220+ throw 0 ;
221+ }
215222 }
216223 else
217224 {
You can’t perform that action at this time.
0 commit comments