https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87760

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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.

Reply via email to