aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-06-09 16:13:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-06-09 16:13:38 -0400
commit55c5c0ad3c32a5c9e5be4a606b9c9925f5416046 (patch)
treedc56334445825e69cbe60b54cc6959e8883f9911
parent948d0d9137b8df8320cae815fd8b8aba86bcc160 (diff)
downloadgcc-55c5c0ad3c32a5c9e5be4a606b9c9925f5416046.zip
gcc-55c5c0ad3c32a5c9e5be4a606b9c9925f5416046.tar.gz
gcc-55c5c0ad3c32a5c9e5be4a606b9c9925f5416046.tar.bz2
PR c++/80384 - ICE with dependent noexcept-specifier
* pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent noexcept-specifier. From-SVN: r249078
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C11
3 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a813de7..944b695 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2017-06-09 Jason Merrill <jason@redhat.com>
+ PR c++/80384 - ICE with dependent noexcept-specifier
+ * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
+ noexcept-specifier.
+
* constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2017-06-09 Jan Hubicka <hubicka@ucw.cz>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ada94bd..99f5b12 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -23438,6 +23438,14 @@ dependent_type_p_r (tree type)
arg_type = TREE_CHAIN (arg_type))
if (dependent_type_p (TREE_VALUE (arg_type)))
return true;
+ if (cxx_dialect >= cxx1z)
+ {
+ /* A value-dependent noexcept-specifier makes the type dependent. */
+ tree spec = TYPE_RAISES_EXCEPTIONS (type);
+ if (spec && TREE_PURPOSE (spec)
+ && value_dependent_expression_p (TREE_PURPOSE (spec)))
+ return true;
+ }
return false;
}
/* -- an array type constructed from any dependent type or whose
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C
new file mode 100644
index 0000000..cc5a3ed
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C
@@ -0,0 +1,11 @@
+// PR c++/80384
+// { dg-options -std=c++17 }
+
+template<class> struct foo;
+template<bool B>
+struct foo<int() noexcept(B)> {
+ static const bool value = B;
+};
+
+static_assert(!foo<int()>::value);
+static_assert(foo<int() noexcept>::value);