🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #273

Bug in using enum ?

#273
From: Jos Warmer
Date: Fri, 25 Jul 1986 11:49
31 lines
1164 bytes
I think there is an error in the handling of enums

	enum color  { red, green };

	typedef struct {
		    color	col   : 1;
		    int         index : 1;
	} test;
	    
	main() { }


gives the following error message:

	"enum.c", line 4: error: non-int field

This is not what I expected after reading the C++ book page 64:

    "The name of the enumeration becomes a synonym for int,
     not a new type."

So col is an int and should be treated in the same way as index.
Does anyone know a fix or a way of avoiding this error ?
The big problem is that this kind of structure is used in
some of the SUN sunview header files, which can not easily
be changed.

-- 

	Jos Warmer,       josw@mcvax.UUCP
Technical Details
Message-ID: <7022@boring.mcvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!josw

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!josw
From: josw@mcvax.uucp (Jos Warmer)
Newsgroups: net.lang.c++
Subject: Bug in using enum ?
Message-ID: <7022@boring.mcvax.UUCP>
Date: Fri, 25-Jul-86 07:49:06 EDT
Article-I.D.: boring.7022
Posted: Fri Jul 25 07:49:06 1986
Date-Received: Fri, 25-Jul-86 21:56:10 EDT
Organization: CWI, Amsterdam
Lines: 30
Apparently-To: rnews@mcvax