Only merge foo() and foo(int) declarations when the former has no body

This commit is contained in:
Michael Tautschnig 2016-09-19 12:16:04 +00:00 committed by Michael Tautschnig
parent 3f29f62474
commit 5c836a49c7
1 changed files with 10 additions and 3 deletions

View File

@ -593,10 +593,16 @@ void linkingt::duplicate_code_symbol(
}
// handle (incomplete) function prototypes
else if(base_type_eq(old_t.return_type(), new_t.return_type(), ns) &&
((old_t.parameters().empty() && old_t.has_ellipsis()) ||
(new_t.parameters().empty() && new_t.has_ellipsis())))
((old_t.parameters().empty() &&
old_t.has_ellipsis() &&
old_symbol.value.is_nil()) ||
(new_t.parameters().empty() &&
new_t.has_ellipsis() &&
new_symbol.value.is_nil())))
{
if(old_t.parameters().empty() && old_t.has_ellipsis())
if(old_t.parameters().empty() &&
old_t.has_ellipsis() &&
old_symbol.value.is_nil())
{
old_symbol.type=new_symbol.type;
old_symbol.location=new_symbol.location;
@ -830,6 +836,7 @@ void linkingt::duplicate_code_symbol(
old_symbol.value=new_symbol.value;
old_symbol.type=new_symbol.type; // for parameter identifiers
old_symbol.is_weak=new_symbol.is_weak;
old_symbol.location=new_symbol.location;
old_symbol.is_macro=new_symbol.is_macro;
}
else if(to_code_type(old_symbol.type).get_inlined())