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

Bug #1620181 reported by Jeffrey Walton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
llvm-toolchain-3.6 (Ubuntu)
New
Undecided
Unassigned

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 http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted

deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe

deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

Revision history for this message
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’

Revision history for this message
Jeffrey Walton (noloader) wrote :

This is kind of interesting from Stack Overflow (http://stackoverflow.com/q/17775390):

<BEGIN SNIP>
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:

#if !_ISOC11_SOURCE
using ::gets;
#endif
<END SNIP>

Revision history for this message
Jeffrey Walton (noloader) wrote :

Also see LLVM Issue 30277: Clang 3.6 cannot compile program with -std=c++14, https://llvm.org/bugs/show_bug.cgi?id=30277 .

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

Other bug subscribers

Remote bug watches

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