+2016-01-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/68586
+ * constexpr.c (clear_cv_cache): New.
+ * cp-gimplify.c (clear_fold_cache): New.
+ * cp-tree.h (clear_cv_cache, clear_fold_cache): Declare.
+ * decl.c (finish_enum_value_list): Call them.
+
2016-01-18 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/11858
return ret;
}
+/* Dispose of the whole CV_CACHE. */
+
+void
+clear_cv_cache (void)
+{
+ gt_cleare_cache (cv_cache);
+}
+
/* Like maybe_constant_value but first fully instantiate the argument.
Note: this is equivalent to instantiate_non_dependent_expr_sfinae
static GTY((cache, deletable)) cache_map fold_cache;
+/* Dispose of the whole FOLD_CACHE. */
+
+void
+clear_fold_cache (void)
+{
+ gt_cleare_cache (fold_cache);
+}
+
/* This function tries to fold an expression X.
To avoid combinatorial explosion, folding results are kept in fold_cache.
If we are processing a template or X is invalid, we don't fold at all.
extern bool cxx_omp_disregard_value_expr (tree, bool);
extern void cp_fold_function (tree);
extern tree cp_fully_fold (tree);
+extern void clear_fold_cache (void);
/* in name-lookup.c */
extern void suggest_alternatives_for (location_t, tree);
extern void explain_invalid_constexpr_fn (tree);
extern vec<tree> cx_error_context (void);
extern tree fold_sizeof_expr (tree);
+extern void clear_cv_cache (void);
/* In c-family/cilk.c */
extern bool cilk_valid_spawn (tree);
/* Finish debugging output for this type. */
rest_of_type_compilation (enumtype, namespace_bindings_p ());
+
+ /* Each enumerator now has the type of its enumeration. Clear the cache
+ so that this change in types doesn't confuse us later on. */
+ clear_cv_cache ();
+ clear_fold_cache ();
}
/* Finishes the enum type. This is called only the first time an
+2016-01-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/68586
+ * g++.dg/cpp0x/enum30.C: New test.
+
2016-01-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/69336
--- /dev/null
+// PR c++/68586
+// { dg-do compile { target c++11 } }
+
+enum E { x , y = 1 + (x << 1) };
+template<E> struct A {};
+A<x> a;
+
+enum E2 : int { x2 , y2 = x2 << 1 };
+template<E2> struct A2 {};
+A2<x2> a2;
+
+enum class E3 { x3 , y3 = x3 << 1 };
+template<E3> struct A3 {};
+A3<E3::x3> a3;