[PATCH] D64820: [Sema] Avoids an assertion failure when an invalid conversion declaration is used

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 6 11:40:39 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL373862: [Sema] Avoids an assertion failure when an invalid conversion declaration is… (authored by rsmith, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64820?vs=218213&id=223434#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64820/new/

https://reviews.llvm.org/D64820

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/SemaCXX/PR31422.cpp


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 at +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 at +2 {{conversion function cannot convert to a function type}}
+struct S {
+  template <typename... Ts> operator auto()(Ts &&... xs) const;
+};
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<CXXRecordDecl>(DC), D.getBeginLoc(), NameInfo, R,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64820.223434.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191006/f97379a6/attachment.bin>


More information about the cfe-commits mailing list