[PATCH] D106216: Disallow narrowing conversions to bool in explicit specififers.

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 22 08:49:08 PDT 2021


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:5638
   ImplicitConversionSequence ICS =
-      CCE == Sema::CCEK_ExplicitBool
-          ? TryContextuallyConvertToBool(S, From)
-          : TryCopyInitialization(S, From, T,
-                                  /*SuppressUserConversions=*/false,
-                                  /*InOverloadResolution=*/false,
-                                  /*AllowObjCWritebackConversion=*/false,
-                                  /*AllowExplicit=*/false);
+      TryCopyInitialization(S, From, T,
+                            /*SuppressUserConversions=*/false,
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > This function is checking converted constant expressions which was not touched by p1401r5, and it looks like this will break anything attempting to to contextual conversion constant expressions of type bool per http://eel.is/c++draft/expr.const#10 because it's removing the attempt to contextually convert to bool here.
> Also, I don't think P1401 was applied as a DR (but we should double check!) so I'd expect some checks for the language standard to gate the behavior. If P1401 was applied as a DR, then we should add some tests to clang/test/CXX with the proper DR markings so that our DR status page gets updated.
It's in the air http://lists.isocpp.org/ext/2021/06/16918.php - Bur Richard took the decision to consider it as a DR
However the changes this patch intends to fix pertaining to preexisting wording, and clang was non-conforming.
P1401 merely put this non-conformity to light.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106216



More information about the cfe-commits mailing list