[clang] [clang] Implement CWG1878 "`operator auto` template" (PR #78103)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 04:52:09 PST 2024


================
@@ -11322,9 +11322,22 @@ Decl *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
       << ClassType << ConvType;
   }
 
-  if (FunctionTemplateDecl *ConversionTemplate
-                                = Conversion->getDescribedFunctionTemplate())
+  if (FunctionTemplateDecl *ConversionTemplate =
+          Conversion->getDescribedFunctionTemplate()) {
+    if (ConvType->isUndeducedAutoType()) {
+      Diag(Conversion->getTypeSpecStartLoc(), diag::err_auto_not_allowed)
+          << Conversion->getTypeSourceInfo()
+                 ->getTypeLoc()
+                 .getContainedAutoTypeLoc()
+                 .getSourceRange()
+          << llvm::to_underlying(Conversion->getConversionType()
+                                     ->getAs<AutoType>()
+                                     ->getKeyword())
----------------
Endilll wrote:

> Can you add tests for constrained auto?

Done. As for the rest of your comment, we sure can work on this, but it's out of scope of this PR.

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


More information about the cfe-commits mailing list