| 1 |
// Tangentially to PR c++/80351 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
// { dg-options "-Wunused-variable" } |
| 4 |
#include <initializer_list> |
| 5 |
|
| 6 |
// Warnings: |
| 7 |
static int int_s1 = 0; // { dg-warning "defined but not used" } |
| 8 |
static int int_s2 = 0; // { dg-warning "defined but not used" } |
| 9 |
inline static int int_is1 = 0; // { dg-warning "defined but not used" } |
| 10 |
inline static int int_is2 = 0; // { dg-warning "defined but not used" } |
| 11 |
// No warnings: |
| 12 |
constexpr static int int_cs1 = 0; // { dg-bogus "defined but not used" } |
| 13 |
constexpr static int int_cs2 = 0; // { dg-bogus "defined but not used" } |
| 14 |
int int_1 = 0; // { dg-bogus "defined but not used" } |
| 15 |
int int_2 = 0; // { dg-bogus "defined but not used" } |
| 16 |
inline int int_i1 = 0; // { dg-bogus "defined but not used" } |
| 17 |
inline int int_i2 = 0; // { dg-bogus "defined but not used" } |
| 18 |
constexpr int int_c1 = 0; // { dg-bogus "defined but not used" } |
| 19 |
constexpr int int_c2 = 0; // { dg-bogus "defined but not used" } |
| 20 |
|
| 21 |
// Warnings: |
| 22 |
static auto int_as1 = 0; // { dg-warning "defined but not used" } |
| 23 |
static auto int_as2 = 0; // { dg-warning "defined but not used" } |
| 24 |
inline static auto int_ais1 = 0; // { dg-warning "defined but not used" } |
| 25 |
inline static auto int_ais2 = 0; // { dg-warning "defined but not used" } |
| 26 |
// No warnings: |
| 27 |
constexpr static auto int_acs1 = 0; // { dg-bogus "defined but not used" } |
| 28 |
constexpr static auto int_acs2 = 0; // { dg-bogus "defined but not used" } |
| 29 |
auto int_a1 = 0; // { dg-bogus "defined but not used" } |
| 30 |
auto int_a2 = 0; // { dg-bogus "defined but not used" } |
| 31 |
inline auto int_ai1 = 0; // { dg-bogus "defined but not used" } |
| 32 |
inline auto int_ai2 = 0; // { dg-bogus "defined but not used" } |
| 33 |
constexpr auto int_ac1 = 0; // { dg-bogus "defined but not used" } |
| 34 |
constexpr auto int_ac2 = 0; // { dg-bogus "defined but not used" } |
| 35 |
|
| 36 |
// Warnings: |
| 37 |
static std::initializer_list<int> il_s1 = {0, 1}; // { dg-warning "defined but not used" } |
| 38 |
static std::initializer_list<int> il_s2 = {0, 1}; // { dg-warning "defined but not used" } |
| 39 |
inline static std::initializer_list<int> il_is1 = {0, 1}; // { dg-warning "defined but not used" } |
| 40 |
inline static std::initializer_list<int> il_is2 = {0, 1}; // { dg-warning "defined but not used" } |
| 41 |
// No warnings: |
| 42 |
constexpr static std::initializer_list<int> il_cs1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 43 |
constexpr static std::initializer_list<int> il_cs2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 44 |
std::initializer_list<int> il_1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 45 |
std::initializer_list<int> il_2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 46 |
inline std::initializer_list<int> il_i1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 47 |
inline std::initializer_list<int> il_i2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 48 |
constexpr std::initializer_list<int> il_c1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 49 |
constexpr std::initializer_list<int> il_c2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 50 |
|
| 51 |
// Warnings: |
| 52 |
static auto il_as1 = {0, 1}; // { dg-warning "defined but not used" } |
| 53 |
static auto il_as2 = {0, 1}; // { dg-warning "defined but not used" } |
| 54 |
inline static auto il_ais1 = {0, 1}; // { dg-warning "defined but not used" } |
| 55 |
inline static auto il_ais2 = {0, 1}; // { dg-warning "defined but not used" } |
| 56 |
// No warnings: |
| 57 |
constexpr static auto il_acs1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 58 |
constexpr static auto il_acs2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 59 |
auto il_a1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 60 |
auto il_a2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 61 |
inline auto il_ai1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 62 |
inline auto il_ai2 = {0, 1}; // { dg-bogus "defined but not used" } |
| 63 |
constexpr auto il_ac1 = {0, 1}; // { dg-bogus "defined but not used" } |
| 64 |
constexpr auto il_ac2 = {0, 1}; // { dg-bogus "defined but not used" } |