work around GCC bug 108860

GCC 12/13/14 can emit spurious warnings for something
as innocent as vec.insert(vec.begin(), 12)...
Reported by Antoine Martin and Quentin Rataud.

* m4/gccwarn.m4: Test the above code and disable GCC's
-Wnull-dereference warning if necessary.
This commit is contained in:
Alexandre Duret-Lutz 2024-06-27 15:39:15 +02:00
parent fdb09f787e
commit c7c18db6db

View file

@ -21,6 +21,7 @@ AC_DEFUN([CF_GXX_WARNINGS],
cat > conftest.$ac_ext <<EOF
#line __oline__ "configure"
#include <string>
#include <vector>
#include <regex>
// From GCC bug 106159
@ -29,6 +30,13 @@ struct left { virtual ~left() {} };
struct right { virtual ~right() {} };
struct both: public left, public right {};
// For GCC bug 108860
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108860
void test(std::vector<int>& v)
{
v.insert(v.begin(), 12);
}
int main(int argc, char *argv[[]])
{
// This string comparison is here to detect superfluous