vancegroup / vr-jugglua

VR JuggLua: A Framework for VR Applications Combining Lua, OpenSceneGraph, and VR Juggler
Boost Software License 1.0
11 stars 12 forks source link

LuaConsole compile error with clang 3.0 #74

Closed casallas closed 12 years ago

casallas commented 12 years ago

I get the following error when compiling vrjugglua with clang 3.0 on Mac OS X 10.6.8 (Snow Leopard):

In file included from /Users/juan/dev/vr-jugglua/vrjugglua/LuaConsole.cpp:22:
/Users/juan/dev/vr-jugglua/vrjugglua/LuaConsole.h:66:13: error: non-const lvalue reference to type 'std::ostream'
      (aka 'basic_ostream<char>') cannot bind to a temporary of type 'vrjLua::detail::LuaConsoleOutputProxy'
                                        return LuaConsoleOutputProxy(_console, val);
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is the problematic line: https://github.com/vancegroup/vr-jugglua/blob/master/vrjugglua/LuaConsole.h#L66

Apparently clang can't convert from LuaConsoleOutputProxy to the reference std::ostream &.

This is not detected on gcc 4.2.

casallas commented 12 years ago

My quick-and-dirty workaround still generates a bunch of warnings like this one:

/Users/juan/dev/vr-jugglua/vrjugglua/LuaConsole.h:67:13: warning: reference to stack memory associated with local
      variable 'luaOutProxy' returned
                                        return luaOutProxy._stream;
                                               ^~~~~~~~~~~

I wonder if the same isn't happening in the original code? (Referencing temporary stack variable)

rpavlik commented 12 years ago

This was a half-baked feature that I really should probably actually remove.

rpavlik commented 12 years ago

Should be fixed by f154c29f39b07dccf5723a05a270e3fd26addf12 which removes said half-baked feature.