This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

c++/7524: "f(const float arg[3])" fails


>Number:         7524
>Category:       c++
>Synopsis:       "f(const float arg[3])" fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 07 08:46:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     braden@endoframe.com
>Release:        3.1.1
>Organization:
>Environment:

>Description:
In the attached demonstration case, g++ is having problems with function argument declarations of the form

  f(const float arg[3]);

Peculiarly, g++ is able to compile the code if the "assign" method in the example is removed.
>How-To-Repeat:
See attached test case.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="test.cc"
Content-Disposition: inline; filename="test.cc"

#   include <string>
#   include <typeinfo>
#   include <vector>

class FieldValue {
public:
	virtual ~FieldValue() throw () = 0;

	virtual FieldValue & assign(const FieldValue & value)
			throw (std::bad_cast, std::bad_alloc) = 0;
};


class SFColor : public FieldValue {
	float d_rgb[3];

public:
	static void HSVtoRGB(const float hsv[3], float rgb[3]) throw ();
	static void RGBtoHSV(const float rgb[3], float hsv[3]) throw ();

	SFColor() throw ();
	virtual ~SFColor() throw ();

	// Use compiler-defined copy ctor and operator=.

	void set(const float rgb[3]) throw ();

	virtual FieldValue & assign(const FieldValue & value)
			throw (std::bad_cast);
};


FieldValue::~FieldValue() throw () {}

SFColor::SFColor() throw () {
    this->d_rgb[0] = 0.0f;
    this->d_rgb[1] = 0.0f;
    this->d_rgb[2] = 0.0f;
}

SFColor::~SFColor() throw () {}

FieldValue & SFColor::assign(const FieldValue & value) throw (std::bad_cast) {
    return (*this = dynamic_cast<const SFColor &>(value));
}

void SFColor::set(const float rgb[3]) throw () {
    this->d_rgb[0] = rgb[0];
    this->d_rgb[1] = rgb[1];
    this->d_rgb[2] = rgb[2];
}

void SFColor::HSVtoRGB(const float hsv[3], float rgb[3]) throw ()
{}

void SFColor::RGBtoHSV(const float rgb[3], float hsv[3]) throw ()
{}

int main()
{}


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