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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 11:39:29 PDT 2019


rjmccall added inline comments.


================
Comment at: include/clang/Sema/Overload.h:977
+
+    void setDestAS(LangAS AS) { DestAS = AS; }
   };
----------------
Can this assert that `Kind == CSK_InitByConstructor || Kind == CSK_InitByUserDefinedConversion`?


================
Comment at: lib/Sema/SemaDeclCXX.cpp:8229
+  if (FTI.hasMethodTypeCVRUQualifiers()) {
+    FTI.MethodQualifiers->forEachCVRUQualifier(
         [&](DeclSpec::TQ TypeQual, StringRef QualName, SourceLocation SL) {
----------------
rjmccall wrote:
> We want to catch `_Atomic`, too, so please just change this loop to ignore address-space qualifiers, using a flag to decide whether to call `setInvalidType`.
If there aren't any qualifiers we're skipping, the flag isn't necessary.


================
Comment at: lib/Sema/SemaOverload.cpp:6038
+                          Constructor->getMethodQualifiers().getAddressSpace(),
+                          CandidateSet.getDestAS())))
     return;
----------------
I think you should add the candidate but mark it as non-viable.


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

https://reviews.llvm.org/D62156





More information about the cfe-commits mailing list