@@ -4607,7 +4607,11 @@ gimplify_init_ctor_eval_range (tree obje
gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
pre_p, cleared);
else
- gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value));
+ {
+ if (gimplify_expr (&value, pre_p, NULL, is_gimple_val, fb_rvalue)
+ != GS_ERROR)
+ gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value));
+ }
/* We exit the loop when the index var is equal to the upper bound. */
gimplify_seq_add_stmt (pre_p,
@@ -0,0 +1,17 @@
+// PR c++/98353
+// { dg-do compile { target c++11 } }
+
+template <int N> struct A {};
+template <typename T>
+struct B
+{
+ static const int n = 1;
+ template <class> A <B<T>::n> foo ();
+ _Complex double c[2], d = 1.0;
+};
+
+void
+bar ()
+{
+ B<int>().foo<int> ();
+}