[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 15:04:48 PDT 2022


zhouyizhou updated this revision to Diff 415601.
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 T>
+void foo() noexcept(T::value);
+struct S {
+  static const bool value;
+};
+
+const bool S::value = 0;
+
+template<class... Args, bool is_noexcept>
+#if __cplusplus >= 201703
+constexpr bool is_noexcept_function(void(Args...) noexcept(is_noexcept)) {
+#else
+constexpr bool is_noexcept_function(void(Args...) noexcept(is_noexcept)) { // expected-note{{candidate template ignored}}
+#endif	
+  return is_noexcept; 
+}
+
+void fn()
+{
+#if __cplusplus >= 201703
+  is_noexcept_function(foo<S>);
+#else
+  is_noexcept_function(foo<S>);	// 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.415601.patch
Type: text/x-patch
Size: 1560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220315/4870ed75/attachment.bin>


More information about the cfe-commits mailing list