From: Richard Smith Date: Wed, 30 Apr 2014 18:15:00 +0000 (+0000) Subject: When typo-correcting a member using declaration, don't exclude member templates. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63e8e2d9a7c10bcac479235898812627cb74650f;p=clang When typo-correcting a member using declaration, don't exclude member templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207681 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index b1b67a648b..c4f6ee13ea 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -7336,10 +7336,6 @@ public: // FIXME: Check that the base class member is accessible? } - if (RequireMemberOf && !isa(ND) && !isa(ND) && - !isa(ND)) - return false; - // Completely unqualified names are invalid for a 'using' declaration. if (Candidate.WillReplaceSpecifier() && !Candidate.getCorrectionSpecifier()) return false; diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp index 2ce0b10908..a91d20b0f3 100644 --- a/test/SemaCXX/using-decl-1.cpp +++ b/test/SemaCXX/using-decl-1.cpp @@ -195,32 +195,43 @@ namespace UsingDeclVsHiddenName { } } -struct Z { - Z(); -}; +namespace PR19171 { + struct Z { + Z(); + }; -typedef struct { - Z i; -} S; + typedef struct { + Z i; + } S; -struct Y : S { - using S::S; // expected-error {{no member named 'S' in 'S'}} -}; + struct Y : S { + using S::S; // expected-error {{no member named 'S' in 'PR19171::S'}} + }; -// [namespace.udecl]p3: In a using-declaration used as a member-declaration, -// the nested-name-specifier shall name a base class of the class being defined. -// If such a using-declaration names a constructor, the nested-name-specifier -// shall name a direct base class of the class being defined; + // [namespace.udecl]p3: In a using-declaration used as a member-declaration, + // the nested-name-specifier shall name a base class of the class being defined. + // If such a using-declaration names a constructor, the nested-name-specifier + // shall name a direct base class of the class being defined; -// FIXME: For c++11, Typo correction should only consider constructor of direct base class -struct PR19171_B { }; // expected-note {{'PR19171_B' declared here}} -struct PR19171_C : PR19171_B { }; -struct PR19171_D : PR19171_C { - using PR19171_B::PR19171_C; // expected-error{{no member named 'PR19171_C' in 'PR19171_B'; did you mean 'PR19171_B'?}} -}; + // FIXME: For c++11, Typo correction should only consider constructor of direct base class + struct B_blah { }; // expected-note {{'B_blah' declared here}} + struct C_blah : B_blah { }; + struct D : C_blah { + using B_blah::C_blah; // expected-error {{no member named 'C_blah' in 'PR19171::B_blah'; did you mean 'B_blah'?}} + }; -struct PR19171_E { }; -struct PR19171_EE { int EE; }; -struct PR19171_F : PR19171_E { - using PR19171_E::EE; // expected-error-re{{no member named 'EE' in 'PR19171_E'{{$}}}} -}; + struct E { }; + struct EE { int EE; }; + struct F : E { + using E::EE; // expected-error-re {{no member named 'EE' in 'PR19171::E'{{$}}}} + }; +} + +namespace TypoCorrectTemplateMember { + struct A { + template void foobar(T); // expected-note {{'foobar' declared here}} + }; + struct B : A { + using A::goobar; // expected-error {{no member named 'goobar' in 'TypoCorrectTemplateMember::A'; did you mean 'foobar'?}} + }; +}