[LLVMbugs] [Bug 24264] Name hiding in the same declarative region fails when done via using-directive

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 25 18:49:11 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24264

Anders Granlund <anders.granlund.0 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Anders Granlund <anders.granlund.0 at gmail.com> ---
Yes, but by [namespace.udir]/2 during the unqualified name lookup of x in
sizeof (x), the declaration struct x {}; appears as if it was declared in the
declarative region of the global namespace, so the name lookup will appear to
be affected by the type of name hiding described in [basic.scope.hiding]/2.

Just like the way name lookup of  i  in the example below appears to be
affected by normal name hiding. When performing unqualified name lookup of  i 
in  f  the definition  static int i = 2;  appears to be made in the declarative
region of  T, and therefore appears to hide  i  in the definition  static int i
= 1;  That is why we get the result 2 printed out in the example below:

  #include <iostream>
  static int i = 1;
  namespace T {
    namespace N { static int i = 2; }
    namespace M {
      using namespace N;
      void f() { std::cout << i << std::endl; }
    }
  }
  int main() { T::M::f(); }

I still think the program in the bug report is well-formed because of this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150726/dbbf33d3/attachment.html>


More information about the llvm-bugs mailing list