By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,128 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,128 IT Pros & Developers. It's quick & easy.

Is this legal?

P: n/a

class A {
public:
enum E { EN1, EN2, EN3 };
};

class B {
public:
void f(const char *s, A::E en = A::E::EN1);
};

MSVC 7.1 accepts it, G++ 3.2.2 (3.2.2-3mdk) gives the following error:
`A::E' is not an aggregate type

Is this an error in G++ or in VC? What does the Holy Standard say?
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
red floyd wrote:

class A {
public:
enum E { EN1, EN2, EN3 };
};

class B {
public:
void f(const char *s, A::E en = A::E::EN1);
};

MSVC 7.1 accepts it, G++ 3.2.2 (3.2.2-3mdk) gives the following error:
`A::E' is not an aggregate type

Is this an error in G++ or in VC? What does the Holy Standard say?


Oops. The error is in reference to the A::E::EN1 default parameter value.
Jul 22 '05 #2

P: n/a
red floyd wrote:
red floyd wrote:

class A {
public:
enum E { EN1, EN2, EN3 };
};

class B {
public:
void f(const char *s, A::E en = A::E::EN1);
};

MSVC 7.1 accepts it, G++ 3.2.2 (3.2.2-3mdk) gives the following error:
`A::E' is not an aggregate type

Is this an error in G++ or in VC? What does the Holy Standard say?

Oops. The error is in reference to the A::E::EN1 default parameter value.


Enumerators are names in the same scope where the enumeration type
is declared. I.e. to get to EN1, you say A::EN1, not A::E::EN1.

Victor
Jul 22 '05 #3

P: n/a
Victor Bazarov wrote:
red floyd wrote:
[enumeration scope question redacted]

Enumerators are names in the same scope where the enumeration type
is declared. I.e. to get to EN1, you say A::EN1, not A::E::EN1.

Victor


Thanks, Victor. Appreciate the help.
Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.