[PATCH] Fix for crash due to g++.old-deja/g++.other/using3.C

Richard Smith richard at metafoo.co.uk
Mon Apr 21 14:46:47 PDT 2014


Thanks, this looks good. Please also add test cases (with FIXMEs) for the
two cases mentioned in your FIXME comment, then this looks fine to commit.

On Mon, Apr 21, 2014 at 8:24 AM, Dinesh Dwivedi <dinesh.d at samsung.com>wrote:

>   Hi Richard,
>
>   Thanks for reviewing.
>
>   I have updated patch to handle this issue in typo-correction. This can
> be further improved is we can check if suggested typo belong to base class
> or not.
>
>   I have merged test case  in using-decl-1.cpp as suggested.
>
>   Please have a look.
>
> Hi rjmccall, rsmith,
>
> http://reviews.llvm.org/D3051
>
> CHANGE SINCE LAST DIFF
>   http://reviews.llvm.org/D3051?vs=7764&id=8699#toc
>
> Files:
>   lib/Sema/SemaDeclCXX.cpp
>   test/SemaCXX/using-decl-1.cpp
>
> Index: lib/Sema/SemaDeclCXX.cpp
> ===================================================================
> --- lib/Sema/SemaDeclCXX.cpp
> +++ lib/Sema/SemaDeclCXX.cpp
> @@ -7326,6 +7326,12 @@
>      if (!ND || isa<NamespaceDecl>(ND))
>        return false;
>
> +    // FIXME: We should check if ND is member of base class of class
> having
> +    // using declaration and direct base class in case using declaration
> names
> +    // a constructor.
> +    if (RequireMember && !ND->isCXXClassMember())
> +      return false;
> +
>      if (RequireMember && !isa<FieldDecl>(ND) && !isa<CXXMethodDecl>(ND) &&
>          !isa<TypeDecl>(ND))
>        return false;
> Index: test/SemaCXX/using-decl-1.cpp
> ===================================================================
> --- test/SemaCXX/using-decl-1.cpp
> +++ test/SemaCXX/using-decl-1.cpp
> @@ -194,3 +194,15 @@
>      using A::HiddenLocalExtern2;
>    }
>  }
> +
> +struct Z {
> +  Z();
> +};
> +
> +typedef struct {
> +  Z i;
> +} S;
> +
> +struct Y : S {
> +  using S::S; // expected-error {{no member named 'S' in 'S'}}
> +};
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140421/6c862f21/attachment.html>


More information about the cfe-commits mailing list