This is the mail archive of the gcc-prs@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]

c++/2238: Use of a class member constant as a size for a member array creation is not handled and causes an Internal compiler error in weird places.



>Number:         2238
>Category:       c++
>Synopsis:       Use of a class member constant as a size for a member array creation is not handled and causes an Internal compiler error in weird places.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 08 20:36:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mathew Hounsell
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
SunOS 5.5.1 Generic_103640-34 sun4u sparc sun4u
>Description:
Define a constant as a class member.
Use it in defining a fixed length array class member.
Compiler then falls over in wierd places.

Declaring internal compiler error.
>How-To-Repeat:
typedef unsigned char octet;

class Cell {	
	typedef octet size_type;
	typedef octet value_type;

	static const size_type SIZE;

	value_type data[ SIZE ];
public:
	Cell( void );

	void getFirst( void ) const {
		return data[0]; // Death - Type I - Internal Compiler Error
	}
};

const Cell::size_type Cell::SIZE = 53;

Cell::Cell( void )
{ // Death - Type II - Internal Compiler Error
	data[1] = 5;
}
>Fix:
Stop with error report on declaration.
>Release-Note:
>Audit-Trail:
>Unformatted:


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