[cfe-dev] PATCH: C++ Function Overloading (v2)
akyrtzi at gmail.com
Tue Oct 21 13:37:12 PDT 2008
Doug Gregor wrote:
> Yeah, the example is correct. This was noted in DR 197:
Oh, incorrect examples in the standard, the fun never ends... ;)
Then OverloadedFunctionDecl has a different issue, consider this:
void f(char); #1
void f(int); #2
template<class T> void g(T t)
f(t); #3 //dependent
void f(float); #4
At #3 there's an OverloadedFunctionDecl for the template to reference.
But what about #4 ?
If it gets added to the same OverloadedFunctionDecl then #5 will
incorrectly pick it up, while we do want #6 to pick it up.
Will there be two OverloadedFunctionDecls, one for the template and
another for normal lookup in #6 ? That seems to defeat its purpose.
How about the 'f' in the template at #3 gets represented as a
DependentNameExpr which contains:
-either a list of FunctionDecls found with normal lookup in the template
-or a DeclContext* and IdentifierInfo* and in order to get the
FunctionDecls visible in template context we do not consider
declarations that appeared after the DependentNameExpr (using
SourceLocation to check)
More information about the cfe-dev