From: Jason Merrill Date: Thu, 15 Feb 2018 22:01:33 +0000 (-0500) Subject: PR c++/84045 - ICE with typedef and noexcept. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd39c7d1cbdd55657b7ef773f6fa743dcc328670;p=gcc.git PR c++/84045 - ICE with typedef and noexcept. * except.c (build_noexcept_spec): Use strip_typedefs_expr. From-SVN: r257713 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 58073748315..33746aeb23e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2018-02-15 Jason Merrill + PR c++/84045 - ICE with typedef and noexcept. + * except.c (build_noexcept_spec): Use strip_typedefs_expr. + PR c++/84376 - ICE with omitted template arguments. * pt.c (dguide_name_p): Check for IDENTIFIER_NODE. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 669bf9f6eaf..0b46698b974 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1217,6 +1217,10 @@ build_noexcept_spec (tree expr, int complain) { gcc_assert (processing_template_decl || TREE_CODE (expr) == DEFERRED_NOEXCEPT); + if (TREE_CODE (expr) != DEFERRED_NOEXCEPT) + /* Avoid problems with a function type built with a dependent typedef + being reused in another scope (c++/84045). */ + expr = strip_typedefs_expr (expr); return build_tree_list (expr, NULL_TREE); } } diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept32.C b/gcc/testsuite/g++.dg/cpp0x/noexcept32.C new file mode 100644 index 00000000000..9a435049599 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept32.C @@ -0,0 +1,14 @@ +// PR c++/84045 +// { dg-do compile { target c++11 } } + +template struct K { + static const bool d = true; +}; +template struct B { + typedef K D; + void foo () noexcept (D::d); +}; +template struct P { + P () noexcept (K::d); +}; +P p;