https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67010

            Bug ID: 67010
           Summary: Name hiding in the same declarative region fails when
                    done via using-directive
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following well-formed program:

  namespace N { struct x {}; }
  using namespace N;
  int x;
  int main() { sizeof (x); }

Compile it with the following command line:

  g++ prog.cc -std=c++14 -pedantic-errors

Observe that error messages about name lookup ambiguity are given. I expect to
get no errors when compiling since the program is well-formed.

That the program is well-formed can be seen by applying both [namespace.udir]/2
and [basic.scope.hiding]/2:

  http://eel.is/c++draft/dcl.dcl#namespace.udir-2
  http://eel.is/c++draft/basic.scope.hiding#2

This seems reasonable also, so I don't think this is a defect of the c++
standard.

I tried it with gcc HEAD 6.0.0 201507 here:

  http://melpon.org/wandbox/permlink/GmJgvsbjt5CPdWrA

Reply via email to