diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-07-03 16:25:55 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-07-03 16:25:55 +0000 |
commit | dde369c40a070b79632d3a314197c7ed22cd0742 (patch) | |
tree | 377aafcac72911c464dbc12baa4a7d4c688270b1 | |
parent | 043e9f42d5e588f0c71a95f0e63bc2a55d83b80d (diff) |
PR c++/86378 - functional cast in noexcept-specifier.
* tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@262351 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/tree.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/noexcept33.C | 28 |
3 files changed, 33 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8f11a9d19e96..f7613b55625f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2018-07-03 Jason Merrill <jason@redhat.com> + PR c++/86378 - functional cast in noexcept-specifier. + * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration. + * name-lookup.c (do_push_to_top_level): Don't allocate current_lang_base. (do_pop_from_top_level): Release current_lang_base. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8405ec7de5be..f850640222d3 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1723,9 +1723,9 @@ strip_typedefs_expr (tree t, bool *remove_attributes) tree it; for (it = t; it; it = TREE_CHAIN (it)) { - tree val = strip_typedefs_expr (TREE_VALUE (t), remove_attributes); + tree val = strip_typedefs_expr (TREE_VALUE (it), remove_attributes); vec_safe_push (vec, val); - if (val != TREE_VALUE (t)) + if (val != TREE_VALUE (it)) changed = true; gcc_assert (TREE_PURPOSE (it) == NULL_TREE); } diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept33.C b/gcc/testsuite/g++.dg/cpp0x/noexcept33.C new file mode 100644 index 000000000000..c5a03de38dd1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept33.C @@ -0,0 +1,28 @@ +// PR c++/86378 +// { dg-do compile { target c++11 } } + +struct Pepper {}; +struct Apple { Apple(int) {} }; + +struct Combination : Apple, Pepper +{ + Combination(Pepper p, Apple a) + : Apple(a), Pepper(p) + {} +}; + +struct MyCombination +{ + using Spice = Pepper; + using Fruit = Apple; + + Combination combination; + + template<typename T> + constexpr MyCombination(T&& t) + noexcept(noexcept(Combination(Spice(), Fruit(t)))) + : combination(Spice(), Fruit(t)) + {} +}; + +MyCombination obj(Apple(4)); |