Compiler warnings on OU

Issue #46 wontfix
Bram Stolk created an issue

AndroidStudio gives compiler warnings on OU about template instantiation. 0.15.2 tar ball. (which btw cannot be selected in the 'Version' field of the create new issue dialog.)

In file included from /home/bram/src/opende/ode/src/odeou.h:42:
/home/bram/src/opende/ou/include/ou/enumarrays.h:107:10: warning: instantiation of variable 'odeou::CEnumUnsortedElementArray<unsigned int, 4, dMeshTriangleVertex, 370218716, odeou::CTypeStandardEqual<dMeshTriangleVertex> >::m_aetElementArray' required here, but no definition is available [-Wundefined-var-template]
                return m_aetElementArray[etValue];
                       ^
/home/bram/src/opende/ode/src/collision_trimesh_internal.h:218:75: note: in instantiation of member function 'odeou::CEnumUnsortedElementArray<unsigned int, 4, dMeshTriangleVertex, 370218716, odeou::CTypeStandardEqual<dMeshTriangleVertex> >::Encode' requested here
            dMeshTriangleVertex oppositeIndex = g_VertFlagOppositeIndices.Encode(((m_vert1Flags | m_vert2Flags) ^ CUF__USE_ALL_VERTICES) / CUF__USE_VERTICES_MIN - 1);
                                                                          ^
/home/bram/src/opende/ou/include/ou/enumarrays.h:141:27: note: forward declaration of template entity is here
        static const ElementType m_aetElementArray[];
                                 ^
/home/bram/src/opende/ou/include/ou/enumarrays.h:107:10: note: add an explicit instantiation declaration to suppress this warning if 'odeou::CEnumUnsortedElementArray<unsigned int, 4, dMeshTriangleVertex, 370218716, odeou::CTypeStandardEqual<dMeshTriangleVertex> >::m_aetElementArray' is explicitly instantiated in another translation unit
                return m_aetElementArray[etValue];
                       ^
/home/bram/src/opende/ou/include/ou/enumarrays.h:107:10: warning: instantiation of variable 'odeou::CEnumUnsortedElementArray<unsigned int, 4, dMeshTriangleVertex, 370288
105, odeou::CTypeStandardEqual<dMeshTriangleVertex> >::m_aetElementArray' required here, but no definition is available [-Wundefined-var-template]
                return m_aetElementArray[etValue];
                       ^
/home/bram/src/opende/ode/src/collision_trimesh_internal.h:228:73: note: in instantiation of member function 'odeou::CEnumUnsortedElementArray<unsigned int, 4, dMeshTriangleVertex, 370288105, odeou::CTypeStandardEqual<dMeshTriangleVertex> >::Encode' requested here
            dMeshTriangleVertex startIndex = g_VertFlagEdgeStartIndices.Encode(((m_vert1Flags | m_vert2Flags) ^ CUF__USE_ALL_VERTICES) / CUF__USE_VERTICES_MIN - 1);
                                                                        ^
/home/bram/src/opende/ou/include/ou/enumarrays.h:141:27: note: forward declaration of template entity is here
        static const ElementType m_aetElementArray[];
                                 ^
/home/bram/src/opende/ou/include/ou/enumarrays.h:107:10: note: add an explicit instantiation declaration to suppress this warning if 'odeou::CEnumUnsortedElementArray<unsigned int, 4, dMeshTriangleVertex, 370288105, odeou::CTypeStandardEqual<dMeshTriangleVertex> >::m_aetElementArray' is explicitly instantiated in another translation unit
                return m_aetElementArray[etValue];

Comments (2)

  1. Oleh Derevenko Account Deactivated

    I guess you should ignore these warnings if you cannot suppress them. GCC used to have similar warnings in one of older releases but then they were quickly removed from it in subsequent versions.

    The template does not need to be instantiated in that place since it is accessed via extern declaration.

    The declaration itself is available via includes collision_kernel.h -> odetls.h -> odeou.h -> ou/enumarrays.h and "using _OU_NAMESPACE::CEnumSortedElementArray" in the odeou.h.

    The compiler should be able to deduce field types and sizes from the template declaration it has.

  2. Log in to comment