Summary: | Unable to delete overloads of std::memset on arm | ||
---|---|---|---|
Product: | gcc | Reporter: | Federico Kircheis <federico> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | rejects-valid |
Priority: | P3 | ||
Version: | 6.3.0 | ||
Target Milestone: | 7.0 | ||
Host: | Target: | arm | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Federico Kircheis
2018-10-26 04:19:55 UTC
I can only guess that somehow std::size_t is int?! Can you reproduce it with a simple void foo (int, std::size_t); void foo (std::size_t, int) = delete; that is, avoiding 'memset' and/or the std namespace? Eventually namespace bar { using ::foo; } to mimic what cstring does for memset? I think this must be some issue with the compiler explorer installation. My native AArch64 box compiles your testcase without problems (gcc-7.3). It's completely perverse that size_t would be an int type, as the ABI requires an unsigned long. Also note that arm64 (correctly, AArch64) != arm; they're separate compilers. This is already fixed in gcc-7. Reduced testcase: extern "C" void* memset(void*, int, long unsigned int); namespace std{ using ::memset; using size_t = decltype(sizeof(0)); void* memset(void*, std::size_t count, int ch) = delete; } struct foo{ // POD int a; int* b; char c; }; int main() { foo b[10]; std::memset(&b, 0, sizeof b); std::memset(&b, 0u, sizeof b); } GCC 6 says: memset.cc:6:9: error: deleted definition of 'void* std::memset(void*, std::size_t, int)' void* memset(void*, std::size_t count, int ch) = delete; ^~~~~~ <built-in>: note: previous declaration of 'void* std::memset(void*, int, long unsigned int)' But GCC 7 and later accept it. It was fixed by r242662 for PR c++/71973 So changing to fixed. gcc-6 has just been frozen for the final release. |