This should have more test coverage: at least cover each different kind of 
special member function, const/non-const arguments, explicitly-defaulted 
functions, and cases where a special member of a derived class is deleted 
because the base class's special member would call functions with a `__host__` 
/ `__device__` mismatch.

================
Comment at: lib/Sema/SemaCUDA.cpp:123-133
@@ +122,13 @@
+  llvm::SmallVector<const CXXBaseSpecifier *, 16> Bases;
+  for (const auto &B : ClassDecl->bases()) {
+    if (!ClassDecl->isAbstract() || !B.isVirtual()) {
+      Bases.push_back(&B);
+    }
+  }
+
+  if (!ClassDecl->isAbstract()) {
+    for (const auto &VB : ClassDecl->vbases()) {
+      Bases.push_back(&VB);
+    }
+  }
+
----------------
For a non-abstract class, you'll collect direct vbases twice here (once from 
the bases list and once from the vbases list). The easiest thing to do would be 
to change the condition in the first loop to just

  if (!B.isVirtual())

================
Comment at: lib/Sema/SemaCUDA.cpp:164
@@ +163,3 @@
+          Diag(ClassDecl->getLocation(),
+               diag::err_implicit_member_target_infer_collision)
+              << (unsigned)CSM << InferredTarget.getValue()
----------------
This should be a note, rather than an error.

================
Comment at: lib/Sema/SemaDeclCXX.cpp:5568-5574
@@ +5567,9 @@
+    // failed.
+    bool Const = false;
+    if ((CSM == CXXCopyConstructor &&
+         RD->implicitCopyConstructorHasConstParam()) ||
+        (CSM == CXXCopyAssignment &&
+         RD->implicitCopyAssignmentHasConstParam())) {
+      Const = true;
+    }
+    return inferCUDATargetForImplicitSpecialMember(RD, CSM, MD, Const,
----------------
This is `SMI.ConstArg`.

================
Comment at: lib/Sema/SemaOverload.cpp:5638
@@ +5637,3 @@
+      // Skip the check for callers that are implicit members, because in this
+      // case we still don't know what the member's target is; the target is
+      // inferred for the member automatically, based on the bases and fields 
of
----------------
s/we still don't know/we may not yet know/

http://reviews.llvm.org/D5199



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to