This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60872] New: Cannot memcpy array of restricted pointers


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]