Skip to content

Commit 5c836a4

Browse files
committed
Only merge foo() and foo(int) declarations when the former has no body
1 parent 3f29f62 commit 5c836a4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/linking/linking.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,16 @@ void linkingt::duplicate_code_symbol(
593593
}
594594
// handle (incomplete) function prototypes
595595
else if(base_type_eq(old_t.return_type(), new_t.return_type(), ns) &&
596-
((old_t.parameters().empty() && old_t.has_ellipsis()) ||
597-
(new_t.parameters().empty() && new_t.has_ellipsis())))
596+
((old_t.parameters().empty() &&
597+
old_t.has_ellipsis() &&
598+
old_symbol.value.is_nil()) ||
599+
(new_t.parameters().empty() &&
600+
new_t.has_ellipsis() &&
601+
new_symbol.value.is_nil())))
598602
{
599-
if(old_t.parameters().empty() && old_t.has_ellipsis())
603+
if(old_t.parameters().empty() &&
604+
old_t.has_ellipsis() &&
605+
old_symbol.value.is_nil())
600606
{
601607
old_symbol.type=new_symbol.type;
602608
old_symbol.location=new_symbol.location;
@@ -830,6 +836,7 @@ void linkingt::duplicate_code_symbol(
830836
old_symbol.value=new_symbol.value;
831837
old_symbol.type=new_symbol.type; // for parameter identifiers
832838
old_symbol.is_weak=new_symbol.is_weak;
839+
old_symbol.location=new_symbol.location;
833840
old_symbol.is_macro=new_symbol.is_macro;
834841
}
835842
else if(to_code_type(old_symbol.type).get_inlined())

0 commit comments

Comments
 (0)