https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80351
Bug ID: 80351 Summary: Inconsistent warning for constexpr auto constant when using initializer list (-Wunused-variable) Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: arnetheduck at gmail dot com Target Milestone: --- In the following snippet, these similar variables give different warnings, when compiled with -Wall - I would expect all of them to not give a warning: #include <initializer_list> enum class E { A, B }; constexpr E no_warn2[] = { E::A, E::B }; constexpr auto warn = { E::A, E::B }; constexpr auto no_warn = { E::A, E::B }; // No warning second time around Results in: <source>:7:16: warning: 'warn' defined but not used [-Wunused-variable] constexpr auto warn = { E::A, E::B }; ^~~~ Compiler exited with result code 0 See: https://godbolt.org/g/bHGxar