[cfe-dev] PATCH: Overloaded function declarations in C++

Doug Gregor doug.gregor at gmail.com
Mon Sep 8 11:14:15 PDT 2008


Hi Argiris,

On Mon, Sep 8, 2008 at 11:22 PM, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
> I now see much more clearly the design purpose of "Overload"
> type/OverloadedFunctionDecl.
> If you have something like this:
>
> void f(int); // #1
> void f(float); // #2
> void (*g)(int) = f; // #3
>
> you'd want the "f" expression at #3 to have "Overload" type so that you can
> do "overload conversion".

Exactly.

> What would the expression at #3 look like after the overload resolution ?
> Will the "DeclRefExpr(OverloadedFunctionDecl)" be replaced by a
> "DeclRefExpr(FunctionDecl #1)" ?

Yes, exactly. When we see a DeclRefExpr(OverloadedFunctionDecl) in
Sema, the first thing we'll do is perform overload resolution (in one
of its seven forms) and replace it with a DeclRefExpr(FunctionDecl)
that corresponds to the function selected by overload resolution. The
rest of the Sema routine can then continue is if it had seen the
FunctionDecl.

  - Doug



More information about the cfe-dev mailing list