internal compiler error for -fall-virtual for 2.95.2 FOLLOW-ON
Mark Coletti
mcoletti@clark.net
Thu May 4 21:15:00 GMT 2000
I've managed to find a workaround that works, and one that *this* time will
work from here on out. Moreover, I hope that the workaround will yield insight
into the exact nature of the problem.
The previous workaround involved reordering one of the class' sections such
that they were in the order of private, protected, and public instead of
public, protected, private. However, that workaround failed after changes were
made to the source.
Eliminating all inline functions in the base abstract class, Attribute, removed
all the errors. I'm *guessing* that there's some form of conflict between the
code that handles inline functions, and code that deals with virtual functions.
I've attached the modified code so that you can better effect a comparison
between to the two behaviors. Just replace Attribute.h and Attribute.cpp
with the attached copies. If you need another copy of the entire source
distribution again, just ask and I'll be happy to send it to you.
Hope this helps!
Cheers,
Mark
mcoletti@clark.net
//
// Attribute.h
//
// $Id: Attribute.h,v 1.17 2000/05/05 03:15:38 mcoletti Exp $
//
#ifndef ATTRIBUTE_H
#define ATTRIBUTE_H
#include <boost/smart_ptr.hpp>
#include <string>
#include <map>
#ifndef SELECTOR_H
#include "Selector.h"
#endif
class ostream;
class Attribute
{
public:
Attribute();
Attribute( std::string const & id,
int cost = 1 );
virtual ~Attribute() ;
int cost() const;
// return the attribute cose
void cost( int );
// set the attribute cost
std::string const & id() const;
// return the attribute id or name
void id( std::string const &id );
// set the attribute id
void print( ostream & ) const;
// print out the attribute metadata information
virtual void print( ostream &, Atom const * ) const = 0;
// print out the atom (that hopefully belongs to this attribute)
// in a way that's meaningful for the given attribute; i.e, a
// nominal attribute will use the Atom's bit mask to print out a
// nice string that maps to the enumerated value
virtual void addFeature( std::string const & feature ) = 0;
// add a new feature to the attribute
virtual SelectorPtr makeSelector( Atom const * atom ) const = 0;
// create a selector using the given atom and this attribute;
// i.e., the atom is a value of this attribute and we want to
// make a simple selector of the form [a=v], where a is the
// attribute and v is the value; used by the parser to construct
// events, which are comprised of these selectors
protected:
virtual void print_( ostream& ) const = 0;
/// over-ridden by children and invoked by print()
private:
int cost_;
std::string id_;
friend ostream& operator<<( ostream &, Attribute const & );
}; // Attribute
class AttributeNominal : public Attribute
{
private:
std::map< std::string, AtomNominal > feature_map_;
//
// this is used to map a feature name to a specific atom nominal
// value ; each addFeature call will take the given string and
// assign it to this map with the feature_map_.size()'th bit
// position for the AtomNominals that will belong to this
// attribute
SelectorPtr makeSelector( Atom const * atom ) const;
protected:
void print_( ostream & ) const;
public:
AttributeNominal()
{}
AttributeNominal( std::string const & id )
: Attribute( id )
{ }
int domainSize() const
{
return feature_map_.size();
}
// essentially the number of bits needed to represent all the
// features
void addFeature( std::string const & feature );
// add a new feature to the attribute
void print( ostream &, Atom const * ) const;
~AttributeNominal() {}
}; // class AttributeNominal
class AttributeContinuous : public Attribute
{
private:
double lower_bound_;
double upper_bound_;
protected:
void print_( ostream & ) const;
public:
AttributeContinuous()
: lower_bound_( -1.0 ),
upper_bound_( 1.0 )
{}
AttributeContinuous( std::string const & id )
: Attribute( id ),
lower_bound_( -1.0 ),
upper_bound_( 1.0 )
{}
AttributeContinuous( std::string const & id,
double lb,
double ub )
: Attribute( id ),
lower_bound_( lb ),
upper_bound_( ub )
{}
~AttributeContinuous() {}
void lowerBound( double lb );
double lowerBound() const;
void upperBound( double ub );
double upperBound() const;
void addFeature( std::string const & feature )
{
cout << __FILE__ << ":" << __LINE__ << " not implemented yet\n";
}
SelectorPtr makeSelector( Atom const * atom ) const
{
cout << __FILE__ << ":" << __LINE__ << " not implemented yet\n";
return SelectorPtr( 0x0 );
}
void print( ostream &, Atom const * ) const
{
cout << __FILE__ << ":" << __LINE__ << " not implemented yet\n";
}
}; // class AttributeContinuous
typedef boost::shared_ptr<Attribute> AttributePtr;
// reference counted smart pointer used for heterogenous containers of
// attributes
#endif
More information about the Gcc-bugs
mailing list