470,815 Members | 1,300 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Is this legal?


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
3 3616
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
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
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.

Similar topics

3 posts views Thread by Chris Johnson | last post: by
7 posts views Thread by Nice | last post: by
reply views Thread by mykidisgollum | last post: by
7 posts views Thread by __PPS__ | last post: by
2 posts views Thread by Thomas Paul Diffenbach | last post: by
11 posts views Thread by Alberto Giménez | last post: by
2 posts views Thread by Army1987 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.