File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
regression/cbmc/constructor1 Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11#include <assert.h>
22
33#ifdef __GNUC__
4- int x ;
4+ int x , y ;
55
6+ // forward declaration with and without attribute is ok
67static __attribute__((constructor )) void format_init (void );
8+ static void other_init (void );
79
810static __attribute__((constructor ))
911void format_init (void )
1012{
1113 x = 42 ;
1214 return ;
1315}
16+
17+ static __attribute__((constructor )) void other_init (void )
18+ {
19+ y = 42 ;
20+ }
1421#endif
1522
1623int main ()
1724{
1825#ifdef __GNUC__
1926 assert (x == 42 );
27+ assert (y == 42 );
2028#endif
2129 return 0 ;
2230}
Original file line number Diff line number Diff line change @@ -375,7 +375,9 @@ void c_typecheck_baset::typecheck_redefinition_non_type(
375375
376376 if (
377377 old_ct.return_type () != new_ct.return_type () &&
378- !old_ct.get_bool (ID_C_incomplete))
378+ !old_ct.get_bool (ID_C_incomplete) &&
379+ new_ct.return_type ().id () != ID_constructor &&
380+ new_ct.return_type ().id () != ID_destructor)
379381 {
380382 throw invalid_source_file_exceptiont{
381383 " function symbol '" + id2string (new_symbol.display_name ()) +
You can’t perform that action at this time.
0 commit comments