Clang 3.6 cannot compile program with -std=c++14

Bug #1620181 reported by Jeffrey Walton on 2016-09-05
This bug affects 1 person
Affects Status Importance Assigned to Milestone
llvm-toolchain-3.6 (Ubuntu)

Bug Description

Clang 3.6 provided by Ubuntu claims to support C++14. -std=c++14 is not rejected by the compiler during feature testing.

Attempting to compile a test program:

$ cat test.cxx
#include <string>
int main(int argc, char* argv[])
  return 0;

Results in the following:

$ clang++ -std=c++14 test.cxx -o test.exe
In file included from test.cxx:1:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:52:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/basic_string.h:2815:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/string_conversions.h:43:
/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++ -v
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

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty


$ cat /etc/apt/sources.list | grep -v '^#'

deb trusty main restricted
deb-src trusty main restricted

deb trusty-updates main restricted
deb-src trusty-updates main restricted

deb trusty universe
deb-src trusty universe
deb trusty-updates universe
deb-src trusty-updates universe

deb trusty multiverse
deb-src trusty multiverse
deb trusty-updates multiverse
deb-src trusty-updates multiverse

deb trusty-backports main restricted universe multiverse
deb-src trusty-backports main restricted universe multiverse

deb trusty-security main restricted
deb-src trusty-security main restricted
deb trusty-security universe
deb-src trusty-security universe
deb trusty-security multiverse
deb-src trusty-security multiverse

Jeffrey Walton (noloader) wrote :

GCC simply rejects the argument:

$ g++ -std=c++14 test.cxx -o test.exe
g++: error: unrecognized command line option ‘-std=c++14’

Jeffrey Walton (noloader) wrote :

This is kind of interesting from Stack Overflow (

This note in the gets manpage looks relevant:

    ISO C11 removes the specification of gets() from the C language, and since version 2.16, glibc header files don't expose the function declaration if the _ISOC11_SOURCE feature test macro is defined.

Probably should be:

using ::gets;

Jeffrey Walton (noloader) wrote :

Also see LLVM Issue 30277: Clang 3.6 cannot compile program with -std=c++14, .

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.