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 1
1
#include <assert.h>
2
2
3
3
#ifdef __GNUC__
4
- int x ;
4
+ int x , y ;
5
5
6
+ // forward declaration with and without attribute is ok
6
7
static __attribute__((constructor )) void format_init (void );
8
+ static void other_init (void );
7
9
8
10
static __attribute__((constructor ))
9
11
void format_init (void )
10
12
{
11
13
x = 42 ;
12
14
return ;
13
15
}
16
+
17
+ static __attribute__((constructor )) void other_init (void )
18
+ {
19
+ y = 42 ;
20
+ }
14
21
#endif
15
22
16
23
int main ()
17
24
{
18
25
#ifdef __GNUC__
19
26
assert (x == 42 );
27
+ assert (y == 42 );
20
28
#endif
21
29
return 0 ;
22
30
}
Original file line number Diff line number Diff line change @@ -375,7 +375,9 @@ void c_typecheck_baset::typecheck_redefinition_non_type(
375
375
376
376
if (
377
377
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)
379
381
{
380
382
throw invalid_source_file_exceptiont{
381
383
" function symbol '" + id2string (new_symbol.display_name ()) +
You can’t perform that action at this time.
0 commit comments