[PATCH] D23765: Fix for clang PR 29087

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 29 11:01:57 PDT 2016


rsmith added inline comments.


================
Comment at: lib/Sema/SemaExprCXX.cpp:4390-4391
         // resolution point.
         if (isa<FunctionTemplateDecl>(ND))
           continue;
+        // UsingDecl itself is not a constructor
----------------
You also need to handle the case of an inherited constructor template (`isa<FunctionTemplateDecl>(ND->getUnderlyingDecl())` will do the right thing in both cases).


================
Comment at: lib/Sema/SemaExprCXX.cpp:4395-4397
+        const CXXConstructorDecl *Constructor = nullptr;
+        if (auto *CSD = dyn_cast<ConstructorUsingShadowDecl>(ND)) {
+          Constructor = cast<CXXConstructorDecl>(CSD->getTargetDecl());
----------------
This is better written as

  auto *Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());


================
Comment at: lib/Sema/SemaExprCXX.cpp:4398-4401
+          // Default constructor and copy/move constructor are not inherited.
+          if (Constructor->isDefaultConstructor() ||
+              Constructor->isCopyOrMoveConstructor())
+            continue;
----------------
This is not necessary: Sema has already filtered out the ones that aren't inherited.


https://reviews.llvm.org/D23765





More information about the cfe-commits mailing list