Mordante updated this revision to Diff 218213. Mordante added a comment. Addresses the review remarks:
- Moved the unit test to SemaCXX (also use the PR as name of the file) - Change the unit test to use `-verify` instead of `FileCheck` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64820/new/ https://reviews.llvm.org/D64820 Files: clang/lib/Sema/SemaDecl.cpp clang/test/SemaCXX/PR31422.cpp Index: clang/test/SemaCXX/PR31422.cpp =================================================================== --- /dev/null +++ clang/test/SemaCXX/PR31422.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s + +// expected-error@+3 {{cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const'}} +// expected-error@+2 {{conversion function cannot convert to a function type}} +struct S { + template <typename... Ts> operator auto()(Ts &&... xs) const; +}; Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -8066,6 +8066,9 @@ } SemaRef.CheckConversionDeclarator(D, R, SC); + if (D.isInvalidType()) + return nullptr; + IsVirtualOkay = true; return CXXConversionDecl::Create( SemaRef.Context, cast<CXXRecordDecl>(DC), D.getBeginLoc(), NameInfo, R,
Index: clang/test/SemaCXX/PR31422.cpp =================================================================== --- /dev/null +++ clang/test/SemaCXX/PR31422.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s + +// expected-error@+3 {{cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const'}} +// expected-error@+2 {{conversion function cannot convert to a function type}} +struct S { + template <typename... Ts> operator auto()(Ts &&... xs) const; +}; Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -8066,6 +8066,9 @@ } SemaRef.CheckConversionDeclarator(D, R, SC); + if (D.isInvalidType()) + return nullptr; + IsVirtualOkay = true; return CXXConversionDecl::Create( SemaRef.Context, cast<CXXRecordDecl>(DC), D.getBeginLoc(), NameInfo, R,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits