🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #25

g++ forgets that the scoped names are still compile-type consts

#25
From: Joe Linoff
Date: Tue, 03 Nov 1992 02:27
86 lines
2649 bytes
* VERSION: g++ version 2.2.2

* SOURCE FILE: bug9.cc

=======================================================================
// Test #1 The following code fragment compiles:

    enum test_01 {
	test_01_A, 
	test_01_B, 
	test_01_C = test_01_B,
    };

// Test #2 but the following (equivalent) one does not:

    class test_02 {
    public:
	enum test_02_type {
	    test_02_type_A, 
	    test_02_type_B, 
	    test_02_type_C = test_02_type_B,
	};
    };

// Test #3 Simlilarly, the following compiles:

    enum test_03_type { test_03_type_A, test_03_type_B, test_03_type_C, };

    class test_03_cls {
    public:
	enum test_03_cls_type {
	    test_03_cls_type_X = test_03_type_A,
	    test_03_cls_type_Y = test_03_type_B,
	    test_03_cls_type_Z = test_03_type_C,
	};
    };


// Test #4 but the following does not:


    class test_04_cls {
    public:
	enum test_04_cls_type {
	    test_04_cls_type_A, 
	    test_04_cls_type_B, 
	    test_04_cls_type_C, 
	    };
    };

    class test_04_cls1 {
    public:
	enum test_04_cls1_type {
	    test_04_cls1_type_X = test_04_cls::test_04_cls_type_A,
	    test_04_cls1_type_Y = test_04_cls::test_04_cls_type_B,
	    test_04_cls1_type_Z = test_04_cls::test_04_cls_type_C,
	};
    };


// Somehow, it forgets that the scoped names are still compile-type consts.
=======================================================================

* COMMAND ARGUMENTS:  g++ -g -c bug9.cc

*  tm.h and md
	tm.h -> ./config/tm-sparc.h
	md -> ./config/sparc.md

* MACHINE TYPE and O/S
	SPARCstation 1
	4.1.1

* DESCRIPTION OF INCORRECT BEHAVIOR:

    G++ forgets that the scoped names are still compile type consts.

    Example:

    % g++ -g -c bug9.cc
    bug9.cc:16: `test_02_type_B' undeclared, outside of functions
    bug9.cc:16: enumerator value for `test_02_type_C' not integer constant
    bug9.cc:49: enumerator value for `test_04_cls1_type_X' not integer constant
    bug9.cc:50: enumerator value for `test_04_cls1_type_Y' not integer constant
    bug9.cc:51: enumerator value for `test_04_cls1_type_Z' not integer constant
    %
Technical Details
Message-ID: <9211030227.AA16704@CrossCheck.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!hp-cv!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!crossck.UUCP!joe

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!hp-cv!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!crossck.UUCP!joe
From: joe@crossck.UUCP (Joe Linoff)
Newsgroups: gnu.g++.bug
Subject: g++ forgets that the scoped names are still compile-type consts
Message-ID: <9211030227.AA16704@CrossCheck.COM>
Date: 3 Nov 92 02:27:43 GMT
Article-I.D.: CrossChe.9211030227.AA16704
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 86
Approved: bug-g++@prep.ai.mit.edu