From: Jason Merrill Date: Fri, 9 Jun 2017 20:13:38 +0000 (-0400) Subject: PR c++/80384 - ICE with dependent noexcept-specifier X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55c5c0ad3c32a5c9e5be4a606b9c9925f5416046;p=gcc.git PR c++/80384 - ICE with dependent noexcept-specifier * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent noexcept-specifier. From-SVN: r249078 --- 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);