[cfe-dev] PATCH: C++ Function Overloading (v2)
Argiris Kirtzidis
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:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#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
void h()
{
g(2.3); #5
f(2.3); #6
}
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
context
-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)
-Argiris
More information about the cfe-dev
mailing list