So because of Monkey's whole compile only what's used thing, I went so long without noticing this bug.
Basically, I wrote my own vector classes a while ago, and obviously commands like 'Add', 'Subtract', and 'DotProduct' were needed, but apparently Monkey's GLFW/Desktop target doesn't like two specific methods I made. Essentially my vector is just a nice wrapper for arrays, and because of this, I back most operations by array-based implementations.
So, when I write something like this:
I expect Monkey to either optimize out that last bit when I never bother with the second argument, or just leave it as-is when compiling.
But apparently Trans decided to have conflicted ideals, and just try both:
Here's the output from Trans:
TRANS monkey compiler V1.65
Parsing...
Semanting...
Translating...
Building...
g++ -Wno-free-nonheap-object -I../glfw/include -I../glfw/lib -I../glfw/lib/win32 -I../openal/include -I../stb -c -o ../main.o ../main.cpp
../main.cpp: In member function 'void c_AbstractVector::p_Subtract3(c_AbstractVector*)':
../main.cpp:11042:25: error: 't_A' was not declared in this scope
p_Subtract(t_V->m_Data,t_A.Length());
^
../main.cpp: In member function 'Float c_AbstractVector::p_DotProduct2(c_AbstractVector*)':
../main.cpp:11070:36: error: 't_A' was not declared in this scope
Float t_=p_DotProduct(t_V->m_Data,t_A.Length());
^
<builtin>: recipe for target '../main.o' failed
mingw32-make: *** [../main.o] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS="-Wno-free-nonheap-object" OUT="Debug/MonkeyGame"', return code=2
I have no idea how this happened, but I was able to easily fix it by just adding the length explicitly. That being said, this seems to be a problem with Trans. Or I'm not supposed to use a default-argument like that, but that doesn't really make sense based on what I usually can do.
|