| 1 |
// Origin: PR c++/46170 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
namespace util { |
| 5 |
struct option_value { |
| 6 |
}; |
| 7 |
template <class T> struct options_map_impl { |
| 8 |
typedef T options_struct_type; |
| 9 |
typedef bool (*opt_func)(const option_value&, options_struct_type&); |
| 10 |
template <class V, V K> static bool set_member_constant(const option_value&, |
| 11 |
options_struct_type&, V options_struct_type::*); |
| 12 |
template <class V, V options_struct_type::*mem, V K> static bool |
| 13 |
set_member_constant(const option_value& opt, options_struct_type& t) { |
| 14 |
return set_member_constant<V,K>(opt, t, mem); |
| 15 |
} |
| 16 |
}; |
| 17 |
} |
| 18 |
struct cflat_options { |
| 19 |
bool show_precharges; |
| 20 |
}; |
| 21 |
typedef util::options_map_impl<cflat_options> options_map_impl_type; |
| 22 |
class register_options_modifier { |
| 23 |
typedef options_map_impl_type::opt_func modifier_type; |
| 24 |
public: register_options_modifier(); |
| 25 |
register_options_modifier(const char* Mode, const modifier_type COM, |
| 26 |
const char* h); |
| 27 |
}; |
| 28 |
static const register_options_modifier |
| 29 |
cflat_opt_mod_show_precharges("precharges", |
| 30 |
&options_map_impl_type::set_member_constant<bool, |
| 31 |
&cflat_options::show_precharges, true>, "show precharge expressions"), |
| 32 |
cflat_opt_mod_no_show_precharges("no-" "precharges", |
| 33 |
&options_map_impl_type::set_member_constant<bool, |
| 34 |
&cflat_options::show_precharges, false>, "hide precharge expressions"); |