[cfe-commits] [PATCH for REVIEW] fixes PR10361 (similar names within nested inline namespaces should create ambiguity)

Faisal Vali faisalv at gmail.com
Sun Apr 1 20:15:19 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=10361
Fixes the following bug :
inline namespace Outer {
  int i;
  inline namespace Inner {
    int i;
  }
}
void func() {
  i = 1;  // expected-error, but clang chooses Outer::Inner::i
}

The fix, which seems a little too simple, simply prevents
NamedDecl::declarationReplaces(oldDecl)
from replacing declarations if they actually live in different
namespaces.  I am not sure if this is enough, but it passes all my
tests, and breaks none of the older ones.

Also, I am not sure if I need to double check if one of the namespaces
is truly nested in the other - at first glance, the check seems
unnecessary - but I could be wrong.

Thanks in advance for reviewing!

Faisal Vali
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ambiguous-inline-namespaces-names.patch
Type: application/octet-stream
Size: 4560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120401/f131ad74/attachment.obj>


More information about the cfe-commits mailing list