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:


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:
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to