[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#292961: g++-3.3: g++ -- vastly uninformative error message



The line you are wanting is

#define C const

You may assume that
box, xform_split, and parallelogram are classes,
that insidebox() is a member function of class parallelogram,
and that inverse_image() and intersect() are functions.


With those additions, it becomes quite reasonable C++ code.
In fact, I've now made it compile and execute,
but that's not the point.

The point is not whether the code was correct,
the point is that the error message was not useful.
I don't want to point out the obvious, but the entire function
of a C++ compiler is to help people write computer programs,
and since people make mistakes (or at least I do),
part of a compiler's job is to help the programmer correct
his or her errors.    Providing helpful error messages
is a good way to do this.





The functioning code is as follows:

#define C const

box c_area(C xform_split &xf, C box& databox0, C box& databox1)
{
C parallelogram inv_image_db0(inverse(xf.back), databox0);
C box box0inOUTin(inv_image_db0.insidebox());
C box lc(inverse_image(databox1, xf.fwd));
return intersect(box0inOUTin, lc);
}

The change was in creating a temporary variable to hold
the parallelogram.   Why that fixed it, I don't know,
but I do know that the compiler's error message didn't
help me very much.



Falk Hueffner wrote:
Greg Kochanski <gpk@kochanski.org> writes:


Here's the code:

box c_area(C xform_split &xf, C box& databox0, C box& databox1)
{
// Next is line 84:
C box box0inOUTin(parallelogram(inverse(xf.back), databox0).insidebox());
C box lc(inverse_image(databox1, xf.fwd));
return intersect(box0inOUTin, lc);
}


That doesn't even remotely look like valid code in any C++ standard.
Please provide a *complete* test case.





Reply to: