Topic: Initialization with scoped constants legal?


Author: mec@shell.portal.com (Michael Elizabeth Chastain)
Date: 1995/04/13
Raw View
Is this code legal?

    struct Foo
    {
 public:
     enum Bar { barOne, barTwo, barThree };
 public:
     Bar myBar_;
    };

    Foo myFooOne = { Foo::barOne }; // Ok
    Foo myFooTwo = { barTwo };  // How about this?

g++ 2.6.3 on Linux tells me:
    x2.cc:10: `barTwo' was not declared in this scope

So, should members of 'Foo' be in scope during an initialization of
a structure of type 'Foo'?

Michael Chastain
mec@shell.portal.com