Index: cfe/trunk/lib/Sema/SemaDecl.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp +++ cfe/trunk/lib/Sema/SemaDecl.cpp @@ -8206,6 +8206,9 @@ } SemaRef.CheckConversionDeclarator(D, R, SC); + if (D.isInvalidType()) + return nullptr; + IsVirtualOkay = true; return CXXConversionDecl::Create( SemaRef.Context, cast(DC), D.getBeginLoc(), NameInfo, R, Index: cfe/trunk/test/SemaCXX/PR31422.cpp =================================================================== --- cfe/trunk/test/SemaCXX/PR31422.cpp +++ cfe/trunk/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 operator auto()(Ts &&... xs) const; +};