Clang Project

clang_source_code/test/SemaCXX/libstdcxx_gets_hack.cpp
1// RUN: %clang_cc1 -fsyntax-only %s -std=c++14 -verify
2
3// This is a test for an egregious hack in Clang that works around
4// an issue with libstdc++'s detection of whether glibc provides a
5// ::gets function. If there is no ::gets, ignore
6//   using ::gets;
7// in namespace std.
8//
9// See PR18402 and gcc.gnu.org/PR77795 for more details.
10
11#ifdef BE_THE_HEADER
12
13#pragma GCC system_header
14namespace std {
15  using ::gets;
16  using ::getx; // expected-error {{no member named 'getx'}}
17}
18
19#else
20
21#define BE_THE_HEADER
22#include "libstdcxx_pointer_return_false_hack.cpp"
23
24namespace foo {
25  using ::gets; // expected-error {{no member named 'gets'}}
26}
27
28#endif
29