$ echo $-
himBHs
$ set -h
$ set -i
bash: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
$ set -m
$ set -B
$ set -H
$ set -s
bash: set: -s: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
As a result I can't use this method to restore bash state using
oldstate="$(set +o); set -$-" # POSIXly store all set options.
.
.
set -vx; eval "$oldstate" # restore all options stored.
as described in this Unix & Linux answer
$ bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
EDIT/CONCLUSION:
As the answer below informs, the content of $- includes settings having nothing to do with set, despite the set man entry stating
The current set of options may be found in $-.
which is true, but confusing by omission.
When recording state, use of $- is not required because all the options are already able to recorded for resetting with
% restoreState=$(shopt -po ; shopt -p)
or more selectively for a subset of options, e.g.,
shopt -po | grep -E 'brace|glob' ; shopt -p | grep glob