[Bug c++/86400] [8/9 regression] set<string>::set<char (*)[2]) constructor does not work with array argument

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 4 22:46:00 GMT 2018


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
#include <cassert>
void
foo2 ()
{
  static char root[1][2] = {"/"};
  auto len = __builtin_strlen(*root);
  assert(len == 1);
}

int
main ()
{
  foo2 ();
}


$ g++ set.cc -O1 -foptimize-strlen
$ ./a.out
a.out: set.cc:7: void foo2(): Assertion `len == 1' failed.
Aborted (core dumped)


More information about the Gcc-bugs mailing list