]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/86378 - functional cast in noexcept-specifier.
authorJason Merrill <jason@redhat.com>
Tue, 3 Jul 2018 16:27:04 +0000 (12:27 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 3 Jul 2018 16:27:04 +0000 (12:27 -0400)
* tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.

From-SVN: r262352

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp0x/noexcept33.C [new file with mode: 0644]

index a9fcc709a9230fd33b23d6c5df1f14c391d220b4..4cc49d77cff56fabea9f3bdda22c2947e1cb2236 100644 (file)
@@ -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-06-26  Jason Merrill  <jason@redhat.com>
 
        PR c++/80290 - memory-hog with std::pair.
index 3b25ab92a1573ba598954421bac65cd3629c809e..f24e272b0fdbacd6e14934f2a52452ecc097ee97 100644 (file)
@@ -1670,9 +1670,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 (file)
index 0000000..c5a03de
--- /dev/null
@@ -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));