Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memoryPool::reserve<void>() always returns zero-sized object #753

Open
stgeke opened this issue May 2, 2024 · 1 comment
Open

memoryPool::reserve<void>() always returns zero-sized object #753

stgeke opened this issue May 2, 2024 · 1 comment
Labels
bug Use this label when reporting bugs! runtime Related to the OCCA runtime API
Milestone

Comments

@stgeke
Copy link
Contributor

stgeke commented May 2, 2024

Suggested fix:

namespace occa {
  template <class T>
  occa::memory memoryPool::reserve(const dim_t entries) {
    if (std::is_void<T>::value) return reserve(entries, occa::dtype::byte); 
    return reserve(entries, occa::dtype::get<T>());
  }
}
@kris-rowe kris-rowe added bug Use this label when reporting bugs! runtime Related to the OCCA runtime API labels May 8, 2024
@kris-rowe kris-rowe added this to the v2.1 milestone May 8, 2024
@kris-rowe
Copy link
Member

Note that program specialization based on std::is_void results in undefined behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Use this label when reporting bugs! runtime Related to the OCCA runtime API
Projects
None yet
Development

No branches or pull requests

2 participants