horde3d / Horde3D

Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.
http://horde3d.org/
1.55k stars 308 forks source link

Build of editor fails with clang-40: cannot take the address of an rvalue of type 'float' #110

Closed yurivict closed 6 years ago

yurivict commented 6 years ago

Errors:

/usr/ports/devel/horde3d/work/Horde3D-57678aa/Horde3D/Source/ColladaConverter/converter.cpp:915:20: error: cannot take the address of an rvalue of type 'float'
                fwrite_le<float>(&Matrix4f().x[j], 1, f);
                                 ^~~~~~~~~~~~~~~~
1 error generated.

/usr/ports/devel/horde3d/work/Horde3D-57678aa/Horde3D/Source/Horde3DEngine/egRenderer.cpp:2301:78: error: cannot take the address of an rvalue of type 'float'
        _renderDevice->setShaderConst( _defColorShader.uni_worldMat, CONST_FLOAT44, &Matrix4f().x[0] );
                                                                                    ^~~~~~~~~~~~~~~~

and warnings

/usr/ports/devel/horde3d/work/Horde3D-57678aa/Horde3DEditor/src/QPropertyEditor/Property.cpp:78:7: warning: case value not in enumerated type 'QVariant::Type' [-Wswitch]
        case QMetaType::Float:  
             ^
/usr/ports/devel/horde3d/work/Horde3D-57678aa/Horde3DEditor/src/QPropertyEditor/Property.cpp:103:7: warning: case value not in enumerated type 'QVariant::Type' [-Wswitch]
        case QMetaType::Float:  
             ^
/usr/ports/devel/horde3d/work/Horde3D-57678aa/Horde3DEditor/src/QPropertyEditor/Property.cpp:123:7: warning: case value not in enumerated type 'QVariant::Type' [-Wswitch]
        case QMetaType::Float:  
             ^
algts commented 6 years ago

Hello. You can fix the errors by moving Matrix4f() outside of the expression and passing it as a variable. I'll try to compile horde with clang next week and see whether these errors always occur with clang or just in some configurations.

algts commented 6 years ago

Fixed in both master and develop branches. Warnings are yet to be fixed. Can probably be closed now,

yurivict commented 6 years ago

The problem is gone. Thanks!