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

Dinesh Dwivedi dinesh.d at samsung.com
Mon Apr 21 08:24:16 PDT 2014


  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 --------------
A non-text attachment was scrubbed...
Name: D3051.2.patch
Type: text/x-patch
Size: 1006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140421/5ee92741/attachment.bin>


More information about the cfe-commits mailing list