diff options
author | Jason Merrill <jason@redhat.com> | 2018-07-03 10:13:02 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-07-03 10:13:02 -0400 |
commit | 2831d6814a2f0f01b7ad4dcda1bf488ffb3addd1 (patch) | |
tree | 30219e1aa7265ea912f1f774f426a328368bab2e /gcc | |
parent | a6bac46b65ce7c070f770499bed007a7b466ead6 (diff) | |
download | gcc-2831d6814a2f0f01b7ad4dcda1bf488ffb3addd1.zip gcc-2831d6814a2f0f01b7ad4dcda1bf488ffb3addd1.tar.gz gcc-2831d6814a2f0f01b7ad4dcda1bf488ffb3addd1.tar.bz2 |
PR c++/86378 - functional cast in noexcept-specifier.
* tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
From-SVN: r262343
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/tree.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/noexcept33.C | 28 |
3 files changed, 35 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 53bcb1f..de313ae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +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. + 2018-07-02 Paolo Carlini <paolo.carlini@oracle.com> * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 361248d..b1333f5 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1735,9 +1735,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 0000000..c5a03de --- /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)); |