Hi,

The following code is legal according to the c++ standard:

void f() {
  int g(int a, int b=4);
  {
    int g(int a, int b=5);
  }
}

Because "[snip] That is, declarations in inner scopes do not acquire default
arguments from declarations in outer scopes, and vice versa."

Clang currently quotes this part of the standard in a comment, but does not
adhere to it. The attached patch fixes this so the above code compiles
without errors.

This involves passing information about whether the new and old declarations
are in the same Scope when merging them.

Please review! :)

Cheers,

James

Attachment: cxx-inner-scope-default-args.diff
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to