https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77795

            Bug ID: 77795
           Summary: [6/7 Regression] ::gets declared in C++14 mode
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---
            Target: *-*-gnu-linux

This is a valid C++14 program that is rejected since 6.1:

int gets;
#include <cstdio>

And this should not compile, but is accepted since 6.1:

#include <cstdio>
using ::gets;

Since we switched the default to -std=gnu++14 the configure checks for ::gets
find it is missing from glibc, so we don't define _GLIBCXX_HAVE_GETS, and then
in <cstdio> we do:

#ifndef _GLIBCXX_HAVE_GETS
extern "C" char* gets (char* __s) __attribute__((__deprecated__));
#endif

The configure check should use -std=gnu++98 or -std=gnu++11 (so we correctly
detect the presence of ::gets when it's needed) and the declaration should only
be done for C++98 and C++11 (so we only add it when it's needed).

Reply via email to