From 0a1f7fdb5bb79171694c3ce7db9c9df766f1fbad Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 9 Jun 2017 20:13:38 +0000 Subject: [PATCH] PR c++/80384 - ICE with dependent noexcept-specifier * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent noexcept-specifier. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249078 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 8 ++++++++ gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C | 11 +++++++++++ 3 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a813de7e4be..944b69596fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-06-09 Jason Merrill + 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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ada94bd65ed..99f5b123a84 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 00000000000..cc5a3edf1e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type15.C @@ -0,0 +1,11 @@ +// PR c++/80384 +// { dg-options -std=c++17 } + +template struct foo; +template +struct foo { + static const bool value = B; +}; + +static_assert(!foo::value); +static_assert(foo::value); -- 2.11.4.GIT