This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 212124 - C++11 enum forwards
Summary: C++11 enum forwards
Status: STARTED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks: 212843
  Show dependency tree
 
Reported: 2012-05-05 13:20 UTC by nnnnnk
Modified: 2017-03-31 13:08 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nnnnnk 2012-05-05 13:20:13 UTC
Sample:
namespace one
{
    struct S
    {
        enum { A = 1, B = 2 };
        struct T
        {
            enum { B = 102 };

            enum class E1;
            enum E2 : int;
        };
    };

    enum class S::T::E1 { A1 = A, B1 = B, C1 };
    enum S::T::E2 : int { A1 = A, B1 = B, C1 };

    static_assert(int(S::T::E1::A1) == 1, "error");
    static_assert(int(S::T::E1::B1) == 102, "error");
    static_assert(int(S::T::E1::C1) == 103, "error");

    static_assert(int(S::T::E2::A1) == 1, "error");
    static_assert(int(S::T::E2::B1) == 102, "error");
    static_assert(int(S::T::E2::C1) == 103, "error");
    static_assert(int(S::T::A1) == 1, "error");
    static_assert(int(S::T::B1) == 102, "error");
    static_assert(int(S::T::C1) == 103, "error");
}


namespace two
{
    namespace S
    {
        enum { A = 1, B = 2 };
        namespace T
        {
            enum { B = 102 };

            enum class E1;
            enum E2 : int;
        }
    }

    enum class S::T::E1 { A1 = A, B1 = B, C1 };
    enum S::T::E2 : int { A1 = A, B1 = B, C1 };

    static_assert(int(S::T::E1::A1) == 1, "error");
    static_assert(int(S::T::E1::B1) == 102, "error");
    static_assert(int(S::T::E1::C1) == 103, "error");

    static_assert(int(S::T::E2::A1) == 1, "error");
    static_assert(int(S::T::E2::B1) == 102, "error");
    static_assert(int(S::T::E2::C1) == 103, "error");
    static_assert(int(S::T::A1) == 1, "error");
    static_assert(int(S::T::B1) == 102, "error");
    static_assert(int(S::T::C1) == 103, "error");
}


Sample 2:
template<typename T> struct S1
{
    enum E1 : int;
    enum E1 : T;
    enum class E2 : int;
    enum class E2 : T;
};

template<typename T> enum S1<T>::E1 : int { e1 };
template<typename T> enum class S1<T>::E2 : T { e2 };

S1<int>::E1 x1 = S1<int>::e1;
S1<int>::E1 x11 = S1<int>::E1::e1;
S1<int>::E2 x2 = S1<int>::E2::e2;

enum S1<int>::E1 ex1 = S1<int>::e1;
enum S1<int>::E1 ex11 = S1<int>::E1::e1;
enum S1<int>::E2 ex2 = S1<int>::E2::e2;

Sample 3:
template<typename T> struct S1
{
    enum E1 : int;
    enum class E2 : int;
};

template<typename T> enum S1<T>::E1 : int { e1 };
template<typename T> enum class S1<T>::E2 : T { e2 };

template<> enum S1<int>::E1 : int { i1 };
template<> enum class S1<int>::E2 : int { i2 };

S1<char>::E1 xci = S1<char>::e1;
S1<int>::E1 xi1 = S1<int>::i1;

S1<char>::E2 xc2 = S1<char>::E2::e2;
S1<int>::E2 xi2 = S1<int>::E2::i2;

Sample 4:
enum struct E3 e4;
Comment 1 Vladimir Voskresensky 2012-05-10 09:15:14 UTC
will investigate
Comment 2 Quality Engineering 2012-05-25 05:49:17 UTC
Integrated into 'main-golden', will be available in build *201205250002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/3751b18e4cdc
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixing #212124 - C++11 enum forwards
- introduce enum forward declarations