C++0x strongly typed enums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux