This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60872] New: Cannot memcpy array of restricted pointers
- From: "e.tadeu at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 Apr 2014 12:14:06 +0000
- Subject: [Bug c++/60872] New: Cannot memcpy array of restricted pointers
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60872
Bug ID: 60872
Summary: Cannot memcpy array of restricted pointers
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: e.tadeu at gmail dot com
When trying to use memcpy to copy arrays of restricted pointers, it fails with
the message:
error: '__restrict_' qualifiers cannot be applied to 'void'
This is a failing testcase:
#include <iostream>
#include <cstring>
typedef double* __restrict__ T;
void do_copy(T* a, const T* b)
{
memcpy(a, b, sizeof(T) * 3);
}
int main()
{
double x[3] = {1.5, 2.5, 3.5};
double *p0[3] = {&x[2], &x[1], &x[0]};
double *p1[3];
do_copy(p1, p0);
std::cout << *p1[2] << std::endl;
return 0;
}