[PATCH] D121498: let EST_Uninstantiated in FunctionProtoType::canThrow return CT_Dependent

zhouyizhou via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 17:56:01 PDT 2022


zhouyizhou updated this revision to Diff 415655.
zhouyizhou edited the summary of this revision.

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

https://reviews.llvm.org/D121498

Files:
  clang/lib/AST/Type.cpp
  clang/test/SemaTemplate/class-template-deduction.cpp


Index: clang/test/SemaTemplate/class-template-deduction.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaTemplate/class-template-deduction.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -std=c++11 -verify %s
+// RUN: %clang_cc1 -std=c++17 -verify %s
+// RUN: %clang_cc1 -std=c++1z -verify %s
+#if __cplusplus >= 201703
+// expected-no-diagnostics
+#endif
+template<class U>
+void foo() noexcept(U::X);
+class A {
+public:
+  static const bool X;
+};
+
+const bool A::X = 0;
+
+template<class... B, bool x>
+#if __cplusplus >= 201703
+bool bar(void(B...) noexcept(x)) 
+#else
+bool bar(void(B...) noexcept(x))  // expected-note{{candidate template ignored}}
+#endif
+{
+  return x; 
+}
+
+void func()
+{
+#if __cplusplus >= 201703
+  bar(foo<A>);
+#else
+  bar(foo<A>);	// expected-error{{no matching function for call}}
+#endif	
+}
+
+
Index: clang/lib/AST/Type.cpp
===================================================================
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3325,9 +3325,10 @@
   switch (getExceptionSpecType()) {
   case EST_Unparsed:
   case EST_Unevaluated:
-  case EST_Uninstantiated:
     llvm_unreachable("should not call this with unresolved exception specs");
 
+  case EST_Uninstantiated:
+    return CT_Dependent;
   case EST_DynamicNone:
   case EST_BasicNoexcept:
   case EST_NoexceptTrue:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121498.415655.patch
Type: text/x-patch
Size: 1417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220316/aa4e307a/attachment.bin>


More information about the cfe-commits mailing list