[llvm-bugs] [Bug 30277] New: Clang 3.6 cannot compile program with -std=c++14

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 4 21:40:05 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30277

            Bug ID: 30277
           Summary: Clang 3.6 cannot compile program with -std=c++14
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: noloader at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I'm working on Ubuntu 14.0.5 LTS. Ubuntu provides GCC 4.8 and Clang 3.6.

Clang 3.6 provided by Ubuntu claims to support C++14. -std=c++14 is not
rejected by the compiler during feature testing. The feature test program
includes the C++ header <iosfwd>.

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.

**********

Ubuntu Issue at "Clang 3.6 cannot compile program with -std=c++14",
http://bugs.launchpad.net/ubuntu/+bug/1620181 .

According to http://stackoverflow.com/q/17775390/608639, this issue is present
as early as Clang 3.3.

An interesting answer from a similar error report on Stack Overflow reveals
this (http://stackoverflow.com/a/17776548/608639):

<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>

**********

$ 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160905/30c1cde4/attachment.html>


More information about the llvm-bugs mailing list