https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86608
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This seems to fix it, will test tomorrow EDT. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 365296d6e3b..70c433c5061 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -5351,7 +5351,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, if (t == NULL_TREE) return true; location_t loc = cp_expr_loc_or_loc (t, input_location); - if (TREE_THIS_VOLATILE (t) && !DECL_P (t)) + if (TREE_THIS_VOLATILE (t)) { if (flags & tf_error) error_at (loc, "expression %qE has side-effects", t); diff --git a/gcc/testsuite/g++.dg/cpp0x/pr65327.C b/gcc/testsuite/g++.dg/cpp0x/pr65327.C index c6cefaba692..8a5ee492097 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr65327.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr65327.C @@ -15,4 +15,4 @@ constexpr volatile int bar () { return i; -} +} // { dg-error "expression .i. has side-effects" }