[cfe-dev] PATCH: Cleanup function redeclaration representations
Doug Gregor
doug.gregor at gmail.com
Thu Apr 24 06:23:15 PDT 2008
Hi John,
On Thu, Apr 24, 2008 at 8:57 AM, John Freeman <freeman1 at gmail.com> wrote:
> However, I'm curious if his approach would be able to handle this:
>
> void f(int x = 2); // #1
>
> void f(int x); // #2
> void g() { f(); } // need to see the default argument from declaration #1
Yes, it does. Default arguments from previous declarations get merged
into subsequent declarations. That's why one can write strange things
like:
void f(int x, int y = 2);
void f(int x = 1, int y);
That second declaration looks like nonsense, but it works because the
first declaration has a default argument for the second function
parameter.
- Doug
More information about the cfe-dev
mailing list