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(DC), D.getBeginLoc(), NameInfo, R, Index: clang/test/Sema/conversion_function_to_function.cpp =================================================================== --- /dev/null +++ clang/test/Sema/conversion_function_to_function.cpp @@ -0,0 +1,9 @@ +// RUN: not %clang_cc1 -fsyntax-only -std=c++14 %s 2>&1 | FileCheck %s + +struct S { + template operator auto()(Ts &&... xs) const; +}; + +// CHECK: error: 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' +// CHECK: error: conversion function cannot convert to a function type +// CHECK-NOT: Assertion{{.*}}failed