[Bug c++/83690] New: [8 regression] spurious unused variable warings for variables used only in static_assert
sss@li-snyder.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 4 18:48:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83690
Bug ID: 83690
Summary: [8 regression] spurious unused variable warings for
variables used only in static_assert
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sss@li-snyder.org
Target Milestone: ---
As of
gcc version 8.0.0 20180102 (experimental) (GCC)
gcc gives an unused-but-set warning for variables that are used only in a
static_assert.
For example, with this source:
--- x.cc -------------------------------------
void foo()
{
constexpr bool foo = true;
static_assert(foo, "foo");
}
----------------------------------------------
we get a warning:
$ cc1plus -std=c++17 x.cc -quiet -Wall
x.cc: In function ‘void foo()’:
x.cc:3:18: warning: variable ‘foo’ set but not used [-Wunused-but-set-variable]
constexpr bool foo = true;
^~~
We do not get this warning with gcc 7.2.1.
More information about the Gcc-bugs
mailing list