http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58516
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Or alternatively ... --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5199,7 +5199,9 @@ finish_transaction_stmt (tree stmt, tree compound_stmt, int flags, tree noex) { tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt), noex); - SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt))); + /* This may occur when the STATEMENT_LIST is empty. */ + if (CAN_HAVE_LOCATION_P (body)) + SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt))); TREE_SIDE_EFFECTS (body) = 1; TRANSACTION_EXPR_BODY (stmt) = body; }