[clang-tools-extra] [llvm] [clang] [clang] Implement CWG1878 "`operator auto` template" (PR #78103)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 18 06:47:57 PST 2024
================
@@ -11321,9 +11321,20 @@ Decl *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
<< ClassType << ConvType;
}
- if (FunctionTemplateDecl *ConversionTemplate
- = Conversion->getDescribedFunctionTemplate())
+ if (FunctionTemplateDecl *ConversionTemplate =
+ Conversion->getDescribedFunctionTemplate()) {
+ if (const auto *ConvTypePtr = ConvType->getAs<PointerType>()) {
+ ConvType = ConvTypePtr->getPointeeType();
+ }
+ if (ConvType->isUndeducedAutoType()) {
+ Diag(Conversion->getTypeSpecStartLoc(), diag::err_auto_not_allowed)
+ << getReturnTypeLoc(Conversion).getSourceRange()
+ << llvm::to_underlying(ConvType->getAs<AutoType>()->getKeyword())
+ << /* in declaration of conversion function template */ 24;
----------------
cor3ntin wrote:
```suggestion
<< /* in declaration of conversion function template= */ 24;
```
https://github.com/llvm/llvm-project/pull/78103
More information about the cfe-commits
mailing list