PR c++/85258
* constexpr.c (reduced_constant_expression_p): Return false for null
trees.
* g++.dg/parse/error61.C: New test.
From-SVN: r259355
+2018-04-12 Marek Polacek <polacek@redhat.com>
+
+ PR c++/85258
+ * constexpr.c (reduced_constant_expression_p): Return false for null
+ trees.
+
2018-04-11 Marek Polacek <polacek@redhat.com>
PR c++/85032
bool
reduced_constant_expression_p (tree t)
{
+ if (t == NULL_TREE)
+ return false;
+
switch (TREE_CODE (t))
{
case PTRMEM_CST:
field = NULL_TREE;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), i, idx, val)
{
- if (!val)
- /* We're in the middle of initializing this element. */
- return false;
+ /* If VAL is null, we're in the middle of initializing this
+ element. */
if (!reduced_constant_expression_p (val))
return false;
if (field)
+2018-04-12 Marek Polacek <polacek@redhat.com>
+
+ PR c++/85258
+ * g++.dg/parse/error61.C: New test.
+
2018-04-12 Cesar Philippidis <cesar@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/pr84955.c: Revert 259346.
--- /dev/null
+// PR c++/85258
+// { dg-do compile { target c++11 } }
+
+template<int> void foo()
+{
+ int x[8];
+ for (int& i, j : x) // { dg-error "multiple" }
+ i = 0; // { dg-error "local variable" }
+}
+
+void bar()
+{
+ foo<0>();
+}