https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68586

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
GCC6 uses a cache for evaluated constant expressions:

4019 tree
4020 maybe_constant_value (tree t, tree decl)
4021 {
4022   tree ret = cv_cache.get (t);

The CONST_DECL x is in the cache, associated with 1 of INTEGER_TYPE.  It got
there when we were processing the LSHIFT_EXPR (x << 1) of the enum in
cp_build_binary_op.  At that point, x had INTEGER_TYPE (I guess because enum E
wasn't complete yet).

Later on, when we're in convert_nontype_argument, this function gets CONST_DECL
x already of the enum E type, but we pull out 1 of INTEGER_TYPE from the cache,
and I think this discrepancy might be the problem here.

Reply via email to