+2007-01-27 Volker Reichelt <v.reichelt@netcologne.de>
+
+ Backport:
+ 2006-11-13 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/29106
+ * g++.dg/init/self1.C: New test.
+ * g++.dg/other/fold1.C: Adjust error markers.
+ * g++.dg/init/member1.C: Likewise.
+
+ 2006-08-27 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/28284
+ * g++.dg/template/pr28284.C: New test.
+
2006-11-18 Lee Millward <lee.millward@codesourcery.com>
PR c++/29022
mark_used (decl);
init = DECL_INITIAL (decl);
}
+ /* If INIT is ERROR_MARK_NODE, that may mean that we are
+ presently processing the initializer, so we conservatively
+ treat this situation as meaning that DECL is uninitialized. */
if (init == error_mark_node)
- return error_mark_node;
+ break;
if (!init
|| !TREE_TYPE (init)
|| (integral_p
tree
fold_non_dependent_expr (tree expr)
{
+ if (expr == NULL_TREE)
+ return NULL_TREE;
+
/* If we're in a template, but EXPR isn't value dependent, simplify
it. We're supposed to treat:
+2007-01-27 Volker Reichelt <v.reichelt@netcologne.de>
+
+ Backport:
+ 2006-11-13 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/29106
+ * init.c (constant_value_1): Treat a DECL_INITIAL of
+ error_mark_node as meaning that the variable is uninitialized,
+ rather than erroneously initialized.
+
+ 2006-08-27 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/28284
+ * pt.c (fold_non_dependent_expr): Make sure expr is not dereferenced if it
+ is NULL.
+
2007-01-25 Richard Guenther <rguenther@suse.de>
Backport from mainline:
template<typename T> struct C
{
static const int i = A<T>::i; // { dg-error "incomplete" }
- static const int j = i;
+ static const int j = i; // { dg-error "non-constant expression" }
B<j> b; // { dg-error "not a valid template arg" }
};
--- /dev/null
+// PR c++/29106
+// { dg-do run }
+
+int i;
+
+void f(__SIZE_TYPE__) {
+ i = 3;
+}
+
+
+int main()
+{
+ int* const savepos = sizeof(*savepos) ? 0 : 0;
+
+ f (sizeof (*savepos));
+
+ if (i != 3)
+ return 1;
+}
struct A
{
static const int i = i; // { dg-error "not declared" }
- int x[i]; // { dg-error "variable-size array" }
+ int x[i]; // { dg-error "integral constant-expression" }
};
--- /dev/null
+/* { dg-do compile } */
+
+template<int> struct A
+{
+ static const int i=x; /* { dg-error "was not declared in this scope" } */
+ static const int j, k;
+};
+
+template<int N> const int A<N>::j = i;
+template<int N> const int A<N>::k = j;
+
+A<0> a;