https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86400
Bug ID: 86400 Summary: [8 regression] set<string>::set<char (*)[2]) constructor does not work with array argument Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sch...@linux-m68k.org Target Milestone: --- This fails at -O2, but not at -O. The problem appears to be the basic_string(const char*) constructor miscomputing the arguments for _M_construct, with traits_type::length(__s) returning 0. $ cat set.cc #include <cassert> #include <string> #include <set> void foo1 () { static char root[2] = {"/"}; std::set<std::string, std::less<std::string>> d (&root, &root + 1); bool b = d.find ("/") != d.end (); assert (b); } void foo2 () { static char root[1][2] = {"/"}; std::set<std::string, std::less<std::string>> d (root, root + 1); bool b = d.find ("/") != d.end (); assert (b); } int main () { foo1 (); foo2 (); } $ g++ -O2 -g -Wall set.cc -o set $ ./set set: set.cc:20: void foo2(): Assertion `b' failed.