[PATCH] D60934: [clang] adding explicit(bool) from c++2a

Tyker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 03:54:05 PDT 2019


Tyker marked 2 inline comments as done.
Tyker added inline comments.


================
Comment at: clang/include/clang/AST/DeclBase.h:1539-1541
+    uint64_t NumCtorInitializers : 64 - NumDeclContextBits -
+        NumFunctionDeclBits -
+        /*Other used bits in CXXConstructorDecl*/ 3;
----------------
rsmith wrote:
> I would prefer that we keep an explicit number here so that we can ensure that this field has the range we desire.
couldn't we compute the value and static_assert on it. having to modify this each time we modify DeclContextBits or FunctionDeclBits is sad. and there isn't anything reminding us to do so in some cases.
what would be a reasonable minimum ?


================
Comment at: clang/lib/Sema/SemaInit.cpp:3817-3831
+        if (AllowExplicit || !Conv->isExplicit()) {
           if (ConvTemplate)
-            S.AddTemplateConversionCandidate(ConvTemplate, I.getPair(),
-                                             ActingDC, Initializer, DestType,
-                                             CandidateSet, AllowExplicit,
-                                             /*AllowResultConversion*/false);
+            S.AddTemplateConversionCandidate(
+                ConvTemplate, I.getPair(), ActingDC, Initializer, DestType,
+                CandidateSet, AllowExplicit, AllowExplicit,
+                /*AllowResultConversion*/ false);
           else
----------------
rsmith wrote:
> We no longer pass `false` for `AllowExplicit` to `Add*Candidate` when `CopyInitializing` is `true`. Is that an intentional change?
yes. i didn't found any cases in which AllowExplicit was false but CopyInitializing was true. so i assumed that relying only on AllowExplicit is better. the regression tests passes after the change.


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

https://reviews.llvm.org/D60934





More information about the cfe-commits mailing list