[PATCH] D62156: [Sema] Diagnose addr space mismatch while constructing objects

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 20 11:21:36 PDT 2019


Anastasia marked 3 inline comments as done.
Anastasia added inline comments.


================
Comment at: lib/Sema/SemaInit.cpp:3771
     else {
-      // C++ [over.match.copy]p1:
-      //   - When initializing a temporary to be bound to the first parameter
-      //     of a constructor [for type T] that takes a reference to possibly
-      //     cv-qualified T as its first argument, called with a single
-      //     argument in the context of direct-initialization, explicit
-      //     conversion functions are also considered.
-      // FIXME: What if a constructor template instantiates to such a signature?
-      bool AllowExplicitConv = AllowExplicit && !CopyInitializing &&
-                               Args.size() == 1 &&
-                               hasCopyOrMoveCtorParam(S.Context, Info);
-      S.AddOverloadCandidate(Info.Constructor, Info.FoundDecl, Args,
-                             CandidateSet, SuppressUserConversions,
-                             /*PartialOverloading=*/false,
-                             /*AllowExplicit=*/AllowExplicitConv);
+      // Check that address space match to resolve the constructors correctly.
+      if (Info.Constructor->getMethodQualifiers().isAddressSpaceSupersetOf(
----------------
matches


================
Comment at: lib/Sema/SemaInit.cpp:5023
           else
+              // Check that address space match to resolve the constructors
+              // correctly.
----------------
matches


================
Comment at: test/CodeGenOpenCLCXX/addrspace-ctor.cl:7
+  int i;
+  void bar();
+};
----------------
remove unused bar


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62156/new/

https://reviews.llvm.org/D62156





More information about the cfe-commits mailing list