This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++0x strongly typed enums


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

I am trying out GCC 4.4 (showing as 4.4.0_alpha20090331), and there
seems to be a problem with strongly typed enums (either with GCC, or my
interpretation).

Consider:

class myClass {
	enum class foo {
		fred
	};

	myClass() {
		foo myVar = fred;
	}
};

My interpretation says this shouldn't work, fred shouldn't be in scope,
but it compiles fine.

Consequently, this doesn't work:

class myClass {
	enum class foo {
		fred
	};

	enum class bar {
		fred
	};
};

test.cpp:7: error: declaration of âfredâ
test.cpp:3: error: conflicts with previous declaration âmyClass::foo
myClass::fredâ

Is this a GCC bug, or am I just misinterpreting the proposal?

Cheers, Chris.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknqAGAACgkQ6iqRtkAADZiBKQCgpbeMFu8eYLAMIQwJKiXmySci
exQAoOM0zcVsIQtBsdaoBAOO0JO1z0Fz
=Oiwu
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]