================
@@ -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()
----------------
Endilll wrote:
I went this way mostly because I didn't want `const` qualifier on the member
function to be highlighted, as it's not relevant. But it's getting a bit worse
than this if we go your way:
```
4 | operator const auto() const { return 1.2; } // error: conversion
function template
| ^~~~~~~~~~~~
6 | operator decltype(auto)() const { return 1.2; } // error:
conversion function template
| ^~~~~~~~~~~~~~~~~~~~~~
```
https://github.com/llvm/llvm-project/pull/78103
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits