[Bug c++/56815] New: void pointer arithmetic

d.v.a at ngs dot ru gcc-bugzilla@gcc.gnu.org
Tue Apr 2 16:57:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56815

             Bug #: 56815
           Summary: void pointer arithmetic
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.v.a@ngs.ru


int main()
{
    void *p = 0;
    p += 1;
}

$ gcc -std=c++98 source.cpp

source.cpp: In function 'int main()':
source.cpp:4:7: warning: pointer of type 'void *' used in arithmetic
[-Wpedantic]
     p += 1;
       ^

Why only warning? It must be error. Other compilers reject this code.



More information about the Gcc-bugs mailing list