Metal cpp compile errors

Hi, I trying to use Metal cpp, but I have compile error:

  1. ISO C++ requires the name after '::' to be found in the same scope as the name before '::'

metal-cpp/Foundation/NSSharedPtr.hpp(162):

template <class _Class>
_NS_INLINE NS::SharedPtr<_Class>::~SharedPtr()
{
    if (m_pObject)
    {
        m_pObject->release();
    }
}
  1. Use of old-style cast

metal-cpp/Foundation/NSObject.hpp(149):

template <class _Dst>
_NS_INLINE _Dst NS::Object::bridgingCast(const void* pObj)
{
#ifdef __OBJC__
    return (__bridge _Dst)pObj;
#else
    return (_Dst)pObj;
#endif // __OBJC__
}

XCode Project was generated using CMake:

target_compile_features(${MODULE_NAME} PRIVATE cxx_std_20)

target_compile_options(${MODULE_NAME}
    PRIVATE
        "-Wgnu-anonymous-struct"
        "-Wold-style-cast"
        "-Wdtor-name"
        "-Wpedantic"
        "-Wno-gnu"
)

May be need to set some CMake flags for C++ compiler ?

Hi AndreyOGL_D3D,

The compiler produces this message when compiling older versions of the metal-cpp headers with the clang -Wpedantic flag.

To resolve this issue, please update to latest version of metal-cpp, available on the https://developer.apple.com/metal/cpp website. You can alternatively also remove the -Wpedantic flag from your compile options.

Hi! thank you for your responce, new CMake:

`target_compile_features(${MODULE_NAME} PRIVATE cxx_std_20)

target_compile_options(${MODULE_NAME} PRIVATE "-Wno-error=gnu-anonymous-struct" "-Wno-error=dtor-name" "-Wno-error=old-style-cast" "-Wno-gnu" ... "-Wno-error=deprecated-declarations" )`

  1. Anonymous types declared in an anonymous union are an extension:

MTLAccelerationStructure.hpp:

union { struct { float x; float y; float z; };

  1. ISO C++ requires the name after '::' to be found in the same scope as the name before '::'

NSSharedPtr.hpp

template <class _Class> _NS_INLINE NS::SharedPtr<_Class>::~SharedPtr() __attribute__((no_sanitize("undefined")))

Metal cpp compile errors
 
 
Q