Temporary gcc travis-ci build fixes

Recent gcc snapshots (both gcc 7 snapshots and recent gcc 6 stable
branch snapshots) are triggering an upstream gcc bug when -flto is
enabled (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79296).  This has
been hitting the gcc-7 builds for a while now, but is going to start
hitting the debian testing builds in a few days as well.

The issue is triggered by using -flto in combination with structs or
classes declared in a function, as done in test_alias_initialization,
test_isses, test_methods_and_attributes (and possibly more).

I'm subscribed to the upstream bug, and will submit another PR to
reenable LTO once a fixed gcc is available.

The gcc-7 build also generates some warnings; just ignore them for now
(by turning off -Werror).
diff --git a/.travis.yml b/.travis.yml
index c19cab3..d510047 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -96,13 +96,18 @@
   fi
   if [ -n "$DOCKER" ]; then
     docker pull $DOCKER
+    # Disable LTO with gcc until gcc 79296 is fixed:
+    export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYBIND11_LTO_CXX_FLAGS="
     export containerid=$(docker run --detach --tty \
       --volume="$PWD":/pybind11 --workdir=/pybind11 \
+      --env="CXXFLAGS=$CXXFLAGS" \
       --env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \
       --env=GCC_COLORS=\  \
       $DOCKER)
     docker exec --tty "$containerid" sh -c 'for s in 0 15; do sleep $s; apt-get update && apt-get -qy dist-upgrade && break; done'
     export SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
+    # gcc-7 currently generates warnings; some are upstream bugs, so just turn off -Werror for now
+    if [ "$GCC" = "7" ]; then WERROR=off; fi
   else
     if [ "$TRAVIS_OS_NAME" = "linux" ]; then
       pip install --user --upgrade pip virtualenv
@@ -138,7 +143,7 @@
 - $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
     -DPYBIND11_PYTHON_VERSION=$PYTHON
     -DPYBIND11_CPP_STANDARD=$CPP
-    -DPYBIND11_WERROR=ON
+    -DPYBIND11_WERROR=${WERROR:-ON}
 - $SCRIPT_RUN_PREFIX make pytest -j 2
 - $SCRIPT_RUN_PREFIX make test_cmake_build
 after_failure: cat tests/test_cmake_build/*.log