[Bug c++/83919] New: [8 regression] spurious -Wignored-qualifiers warning
sss@li-snyder.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 17 19:50:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83919
Bug ID: 83919
Summary: [8 regression] spurious -Wignored-qualifiers warning
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: ---
With gcc version
gcc version 8.0.1 20180115 (experimental) (GCC)
compiling this source with -Wextra -std=c++17 gets a warning:
-- x.cc -----------------------------------------
enum class Conf;
struct foo
{
foo (const Conf& conf) : x{conf} {}
const Conf x;
};
--------------------------------------------------
$ ~/gcc/build/gcc/cc1plus -quiet x.cc -Wextra -std=c++17
x.cc: In constructor ‘foo::foo(const Conf&)’:
x.cc:4:34: warning: type qualifiers ignored on cast result type
[-Wignored-qualifiers]
foo (const Conf& conf) : x{conf} {}
^
I don't see any obvious reason why this should give a warning.
The warning goes away if one uses x(conf) rather than x{conf} in the
initialization. I also do not see this warning with gcc 7.2.1.
More information about the Gcc-bugs
mailing list