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

            Bug ID: 68077
           Summary: Namespace having the same name as contained class
                    should not compile
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vgheorgh at gmail dot com
  Target Milestone: ---

According to [7.3.4/6 Using directive [namespace udir]] the following code is
ill-formed, and there is no "no diagnostic required":

template<typename T> 
class Foo{};

namespace X
{
    class X{};
}

using namespace X; // now both class X and namespace X are visible
Foo<X::X> f()
{
    return {};
}

int main() {}

Therefore I believe the code should not compile. Tested with both gcc5.2.x and
gcc6. More details: http://stackoverflow.com/q/33313853/3093378

Reply via email to