[clang] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 04:21:57 PST 2023


================
@@ -14240,6 +14294,114 @@ StmtResult Sema::ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc,
                                                       : IdentLoc);
 }
 
+static ImplicitConversionKind getConversionKind(QualType FromType,
+                                                QualType ToType) {
+  if (ToType->isIntegerType()) {
+    if (FromType->isComplexType())
+      return ICK_Complex_Real;
+    if (FromType->isFloatingType())
+      return ICK_Floating_Integral;
+    if (FromType->isIntegerType())
+      return ICK_Integral_Conversion;
+  }
+
+  if (ToType->isFloatingType()) {
+    if (FromType->isComplexType())
+      return ICK_Complex_Real;
+    if (FromType->isFloatingType())
+      return ICK_Floating_Conversion;
+    if (FromType->isIntegerType())
+      return ICK_Floating_Integral;
+  }
+
+  return ICK_Identity;
+}
----------------
Fznamznon wrote:

> I wonder if we should expose (some of) the logic of IsStandardConversion() from SemaOverload.cpp

You mean part starting from
https://github.com/llvm/llvm-project/blob/af65379e383bac651f0868237e9086630b15ee0d/clang/lib/Sema/SemaOverload.cpp#L2074 ?

If yes, how this will help better with the problem of adding new conversions?

https://github.com/llvm/llvm-project/pull/73099


More information about the cfe-commits mailing list