Skip to content

Commit 0a7971e

Browse files
author
Daniel Kroening
committed
Merge pull request #102 from tautschnig/attribute-constructor-bugfix
Support for postfixed __attribute__((constructor))
2 parents 02b6628 + 962b7d6 commit 0a7971e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/ansi-c/ansi_c_convert_type.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,21 +288,28 @@ void ansi_c_convert_typet::write(typet &type)
288288
error_msg();
289289
throw 0;
290290
}
291-
else if(type.id()!=ID_empty)
291+
292+
typet *type_p=&type;
293+
if(type.id()==ID_code)
294+
type_p=&(to_code_type(type).return_type());
295+
296+
else if(type_p->id()!=ID_empty)
292297
{
293298
err_location(source_location);
294-
str << "constructor and destructor required to be type void";
299+
str << "constructor and destructor required to be type void, "
300+
<< "found " << type_p->pretty();
295301
error_msg();
296302
throw 0;
297303
}
298304

299-
type.id(constructor ? ID_constructor : ID_destructor);
305+
type_p->id(constructor ? ID_constructor : ID_destructor);
300306
}
301307
}
302308
else if(constructor || destructor)
303309
{
304310
err_location(source_location);
305-
str << "constructor and destructor required to be type void";
311+
str << "constructor and destructor required to be type void, "
312+
<< "found " << type.pretty();
306313
error_msg();
307314
throw 0;
308315
}

0 commit comments

Comments
 (0)