rsmith added a comment.
I'm concerned that name lookup will find an inappropriate declaration after
this merging. If we have two visible declarations of a function in the same
scope, and one has a prototype but the other does not, the user should be able
to rely on the prototype being used. `isPreferredLookupResult` in
SemaLookup.cpp picks the most recent declaration in an attempt to handle this,
but that won't do the right thing here, so you should also teach it to prefer a
prototyped function over an unprototyped one.
You should be able to test for this case by trying to pass a pointer to the
wrong type to `func1`. (You may need a different testcase that provides the
prototype in the .c file and the declaration without prototype in the header in
order to hit this, depending on which result name lookup ends up preferring.)
================
Comment at: lib/Serialization/ASTReaderDecl.cpp:2715
return (FuncX->getLinkageInternal() == FuncY->getLinkageInternal()) &&
FuncX->getASTContext().hasSameType(FuncX->getType(), FuncY->getType());
}
----------------
Instead of your change, can we change this to use `typesAreCompatible` instead
of `hasSameType`?
https://reviews.llvm.org/D25001
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits