http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60265

            Bug ID: 60265
           Summary: [C++11] using-declarator of enumerator fails if fully
                    qualified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roger.ferrer at bsc dot es

Hi,

a using-declarator the nested-name of which includes an enumerator-name fails,
as g++ seems to expect only namespace-names at this point.

This seems a specific lookup problem of the using-declarator. Other
qualified-ids, seem to work, as shown in the snippet below.

// -- enum.cc
namespace A
{
    enum E { V };
}

namespace B
{
    void f1()
    {
        int x;
        x = A::E::V; // OK
        x = A::V;    // OK
    }

    void f2()
    {
        using A::V; // OK
        int x;
        x = V;
    }

    void f3()
    {
        using A::E::V; // ERR (but should be OK)
        int x;
        x = V;
    }
}
// -- end of enum.cc

$ ~/soft/gcc-experiment/gcc-install/bin/g++ -std=c++11 --version
g++ (GCC) 4.9.0 20140218 (experimental)

$ g++ -std=c++11 -c enum.cc
enum.cc: In function ‘void B::f3()’:
enum.cc:24:21: error: ‘A::E’ is not a namespace
         using A::E::V; // ERR
                     ^
enum.cc:26:13: error: ‘V’ was not declared in this scope
         x = V;
             ^
enum.cc:26:13: note: suggested alternative:
enum.cc:3:14: note:   ‘V’
     enum E { V };

Kind regards,

Reply via email to