[Bug c++/78491] New: invalid conversion from 'const void*' to 'void*'

lucanus81 at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 23 10:03:00 GMT 2016


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

            Bug ID: 78491
           Summary: invalid conversion from 'const void*' to 'void*'
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucanus81 at gmail dot com
  Target Milestone: ---

Created attachment 40125
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40125&action=edit
test case

when compiling the testcase attached here I get:
#include <iostream>
#include <vector>
#include <string>

void lprintc(const std::vector<const std::string> &vect) {
  for (const auto &s1 : vect)
    std::cout << s1 << std::endl;
}

int main() {
  const std::vector<const std::string> lines = { "one", "two", "three" };
  lprintc(lines);

  return 0;
}

/usr/local/gcc-head/include/c++/7.0.0/ext/new_allocator.h:121:23: error:
invalid conversion from 'const void*' to 'void*' [-fpermissive]
      ::operator delete(__p, std::align_val_t(alignof(_Tp)));
(plus many more lines: see full_error.txt attached)

I can see this error with any version. clang correctly accepts this code.
I don't know whether this is a bug or not.

Thanks


More information about the Gcc-bugs mailing list