Skip to content

Compilation failed: Clang 22 + modules #540

Description

@d-krylov

Hello. I use vma in a small custom engine with clang22 and c++ modules. I have encountered the following problem.
Allocator.cppm:

module;
#include <vma/vk_mem_alloc.h>
export module rhi:allocator;
// Only an interface here

Allocator.cpp:

module;
#define  VMA_IMPLEMENTATION
#include <vma/vk_mem_alloc.h>
module rhi;
// An implementation here

Causes

.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4222:9: error: no matching function for call to 'VmaFree'
 4222 |         VmaFree(pAllocationCallbacks, ptr);
      |         ^~~~~~~
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4257:9: note: in instantiation of function template specialization 'vma_delete_array<char>' requested here
 4257 |         vma_delete_array(allocs, str, len + 1);
      |         ^
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4479:20: error: no matching function for call to 'VmaFree'
 4479 |     ~VmaVector() { VmaFree(m_Allocator.m_pCallbacks, m_pArray); }
      |                    ^~~~~~~
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:5695:14: note: in instantiation of member function 'VmaVector<char, VmaStlAllocator<char>>::~VmaVector' requested here
 5695 |     explicit VmaStringBuilder(const VkAllocationCallbacks* allocationCallbacks) : m_Data(VmaStlAllocator<char>(allocationCallbacks)) {}
      |              ^
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4609:9: error: no matching function for call to 'VmaFree'
 4609 |         VmaFree(m_Allocator.m_pCallbacks, m_pArray);
      |         ^~~~~~~
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:5720:16: note: in instantiation of member function 'VmaVector<char, VmaStlAllocator<char>>::resize' requested here
 5720 |         m_Data.resize(oldCount + strLen);
      |                ^
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4479:20: error: no matching function for call to 'VmaFree'
 4479 |     ~VmaVector() { VmaFree(m_Allocator.m_pCallbacks, m_pArray); }
    ...

fdelayed-template-parsing works around the problem, but it doesn't seem like a good solution.
What do you think?
Best regards!
Denis.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions