Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -12134,16 +12134,6 @@ // invalid). if (R.empty() && NameInfo.getName().getNameKind() != DeclarationName::CXXConstructorName) { - // HACK: Work around a bug in libstdc++'s detection of ::gets. Sometimes - // it will believe that glibc provides a ::gets in cases where it does not, - // and will try to pull it into namespace std with a using-declaration. - // Just ignore the using-declaration in that case. - auto *II = NameInfo.getName().getAsIdentifierInfo(); - if (getLangOpts().CPlusPlus14 && II && II->isStr("gets") && - CurContext->isStdNamespace() && - isa(LookupContext) && - getSourceManager().isInSystemHeader(UsingLoc)) - return nullptr; UsingValidatorCCC CCC(HasTypenameKeyword, IsInstantiation, SS.getScopeRep(), dyn_cast(CurContext)); if (TypoCorrection Corrected = Index: clang/test/SemaCXX/libstdcxx_gets_hack.cpp =================================================================== --- clang/test/SemaCXX/libstdcxx_gets_hack.cpp +++ clang/test/SemaCXX/libstdcxx_gets_hack.cpp @@ -8,11 +8,13 @@ // // See PR18402 and gcc.gnu.org/PR77795 for more details. +// The gcc bug was gfixed in 2016. now check gets is not special + #ifdef BE_THE_HEADER #pragma GCC system_header namespace std { - using ::gets; + using ::gets; // expected-error {{no member named 'gets'}} using ::getx; // expected-error {{no member named 'getx'}} }