]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
authorMarek Polacek <polacek@redhat.com>
Tue, 8 Oct 2019 13:38:35 +0000 (13:38 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 8 Oct 2019 13:38:35 +0000 (13:38 +0000)
* pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
the first operand.

From-SVN: r276699

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1y/var-templ63.C [new file with mode: 0644]

index 297eb6f0e9b2b7c569717c2964e8d3044d1ba055..9a9dc437231b30c949e37c41f01fd89f5fa316d6 100644 (file)
@@ -1,3 +1,12 @@
+2019-10-08  Marek Polacek  <polacek@redhat.com>
+
+       Backported from mainline
+       2019-09-15  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
+       * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
+       the first operand.
+
 2019-09-28  Marek Polacek  <polacek@redhat.com>
 
        Backported from mainline
index 34d440c7eb5882494daefeeb83347b9399fa8352..442e01bfa1177dc725bbb0566c89a83757006548 100644 (file)
@@ -26715,7 +26715,7 @@ build_non_dependent_expr (tree expr)
   if (TREE_CODE (expr) == COND_EXPR)
     return build3 (COND_EXPR,
                   TREE_TYPE (expr),
-                  TREE_OPERAND (expr, 0),
+                  build_non_dependent_expr (TREE_OPERAND (expr, 0)),
                   (TREE_OPERAND (expr, 1)
                    ? build_non_dependent_expr (TREE_OPERAND (expr, 1))
                    : build_non_dependent_expr (TREE_OPERAND (expr, 0))),
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ63.C b/gcc/testsuite/g++.dg/cpp1y/var-templ63.C
new file mode 100644 (file)
index 0000000..a65f53b
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
+// { dg-do compile { target c++14 } }
+
+constexpr bool f(const char*) { return true; }
+template<typename T> const char c = "FOO"[f("BAR") ? 1 : 0];