Compile error in line-geometry.cpp with struct assignment for gcc 3.3
Hello, When I try to build svn 15634 using gcc 3.3 (OS X 10.3), I get a compile error:
line-geometry.cpp: In member function `virtual NR::MaybeNR::Point Box3D::Line::intersect(const Box3D::Line&)': line-geometry.cpp:57: error: parse error before `;' token
I was able to build 0.45.1 in this same environment, so this error is relatively new. The error seems to be caused when something is set to NR::Nothing. This example causes the same error:
namespace NR { struct Nothing {}; }; void function() { void* junk = NR::Nothing; //<---- parse error }
I played with this a bit, and found that the problem is not related to the namespace nor to the fact that the struct has no members.
Does this sound familiar to anyone, or can anyone recommend a way (search terms) to find out more about this?
Thanks!, John
On Thu, 2007-08-09 at 08:50 -0700, John Faith wrote:
I played with this a bit, and found that the problem is not related to the namespace nor to the fact that the struct has no members.
NR::Nothing should have parenthesis, as it is constructing a value; e.g. NR::Nothing(). I think this is a typo in the SVN version.
-mental
MenTaLguY schrieb:
On Thu, 2007-08-09 at 08:50 -0700, John Faith wrote:
I played with this a bit, and found that the problem is not related to the namespace nor to the fact that the struct has no members.
NR::Nothing should have parenthesis, as it is constructing a value; e.g. NR::Nothing(). I think this is a typo in the SVN version.
The SVN version has these parentheses. Actually, I'm a bit confused since line-geometry.cpp is one of the files I added in revision 15169, but I didn't touch it since then, and it compiles flawlessly here ever since. Also, given that revision 15634 (the one where John's problem occurred) is already one week old, I guess there would have been complaints if it didn't compile. Is anyone else seeing this?
Max
On 8/10/07, Maximilian Albert <Anhalter42@...173...> wrote:
MenTaLguY schrieb:
On Thu, 2007-08-09 at 08:50 -0700, John Faith wrote:
I played with this a bit, and found that the problem is not related to the namespace nor to the fact that the struct has no members.
NR::Nothing should have parenthesis, as it is constructing a value; e.g. NR::Nothing(). I think this is a typo in the SVN version.
The SVN version has these parentheses. Actually, I'm a bit confused since line-geometry.cpp is one of the files I added in revision 15169, but I didn't touch it since then, and it compiles flawlessly here ever since. Also, given that revision 15634 (the one where John's problem occurred) is already one week old, I guess there would have been complaints if it didn't compile. Is anyone else seeing this?
Max
Oops, my example was wrong (thanks for pointing that out), and adding the parens in my example fixes it, but line-geometry.cpp is still failing for me.
The line:
g_return_val_if_fail(fabs(denom) > 1e-6, NR::Nothing());
is causing the failure, and if I replace it with these 2 lines:
NR::MaybeNR::Point no_point = NR::Nothing(); g_return_val_if_fail(fabs(denom) > 1e-6, no_point);
, then the compiler is for some reason happier. Not sure if this is a reasonable thing to patch on all platforms or if this should get a gcc3/apple ifdef. I made this change just in line-geometry.cpp and was able to get through the whole build.
, John
participants (3)
-
John Faith
-
Maximilian Albert
-
MenTaLguY