Clang: Tests: Fix compilation with clang-3.6 using stdlib

When using stdlib (default on Linux) and compiling with "-std=c++14", errors
like the following occurr. Avoid them by not requiring c++14.

  $ clang --version
  Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)
  Target: x86_64-pc-linux-gnu
  Thread model: posix

  $ cat clangtest.cpp
  #include <random>

  $ clang -std=c++11 -fsyntax-only clangtest.cpp # Fine with c++11/stdlibc++
  $ clang -std=c++14 -fsyntax-only clangtest.cpp # Ops with c++14/stdlibc++
  In file included from clangtest.cpp:1:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/algorithm:62:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:65:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/random:39:
  /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
    using ::gets;
          ~~^
  1 error generated.
  $ clang -std=c++14 -stdlib=libc++ -fsyntax-only clangtest.cpp # Fine with c++14/libc++

See also https://llvm.org/bugs/show_bug.cgi?id=18402.

Change-Id: I2ab3ea837b80196b51d8816ee8aa26a4a531e939
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2016-04-15 10:40:33 +02:00
committed by Nikolai Kosjar
parent bb8f8b56f1
commit 211894d348
2 changed files with 2 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ QT += core network
QT -= gui
TARGET = echo
CONFIG += console c++14
CONFIG += console c++11
CONFIG -= app_bundle
TEMPLATE = app

View File

@@ -6,7 +6,7 @@ include(creator_dependency.pri)
include(benchmark_dependency.pri)
QT += core network testlib widgets
CONFIG += console c++14 testcase object_parallel_to_source
CONFIG += console c++11 testcase object_parallel_to_source
CONFIG -= app_bundle
OBJECTS_DIR = $$OUT_PWD/obj # workaround for qmake bug in object_parallel_to_source