summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2018-07-17 17:10:19 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2018-07-17 17:10:19 +0200
commit927d754ffda9ab2ced9627f0cce07720345baddc (patch)
treee3e96fc638fac78a1257b32e4e8d88fa03e10ef7
parent0d8f3cc3ab30b7bb82716de76e4e5afeaf85daac (diff)
downloadsigc++-927d754ffda9ab2ced9627f0cce07720345baddc.tar.gz
Qualify calls to bitwise_equivalent_cast() with namespace names
Otherwise indirect calls from glibmm, with its own bitwise_equivalent_cast(), can be ambiguous due to ADL (argument-dependent lookup).
-rw-r--r--sigc++/functors/macros/slot.h.m415
-rw-r--r--sigc++/macros/signal.h.m414
2 files changed, 17 insertions, 12 deletions
diff --git a/sigc++/functors/macros/slot.h.m4 b/sigc++/functors/macros/slot.h.m4
index a6c90cf..dee0b13 100644
--- a/sigc++/functors/macros/slot.h.m4
+++ b/sigc++/functors/macros/slot.h.m4
@@ -63,7 +63,7 @@ FOR(1, $1,[
inline T_return operator()(LOOP(arg%1_type_ _A_a%1, $1)) const
{
if (!empty() && !blocked())
- return (internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(LIST(slot_base::rep_, LOOP(_A_a%1, $1)));
+ return (sigc::internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(LIST(slot_base::rep_, LOOP(_A_a%1, $1)));
return T_return();
}
@@ -355,7 +355,7 @@ ifelse($1,0,[
* @return A function pointer formed from call_it().
*/
static hook address()
- { return bitwise_equivalent_cast<hook>(&call_it); }
+ { return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
};
])
@@ -385,6 +385,11 @@ namespace internal {
*
* When reinterpret_cast causes a compiler warning or error, this function
* may work. Intended mainly for conversion between different types of pointers.
+ *
+ * Qualify calls with namespace names: sigc::internal::bitwise_equivalent_cast<>().
+ * If you don't, indirect calls from another library that also contains a
+ * bitwise_equivalent_cast<>() (perhaps glibmm), can be ambiguous due to ADL
+ * (argument-dependent lookup).
*/
template <typename out_type, typename in_type>
inline out_type bitwise_equivalent_cast(in_type in)
@@ -502,7 +507,7 @@ struct slot_call
* @return A function pointer formed from call_it().
*/
static hook address()
- { return bitwise_equivalent_cast<hook>(&call_it); }
+ { return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
};
/** Abstracts functor execution.
@@ -534,7 +539,7 @@ struct slot_call<T_functor, T_return>
* @return A function pointer formed from call_it().
*/
static hook address()
- { return bitwise_equivalent_cast<hook>(&call_it); }
+ { return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
};
} /* namespace internal */
@@ -594,7 +599,7 @@ public:
inline T_return operator()(type_trait_take_t<T_arg>... _A_a) const
{
if (!empty() && !blocked())
- return (internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
+ return (sigc::internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
return T_return();
}
diff --git a/sigc++/macros/signal.h.m4 b/sigc++/macros/signal.h.m4
index 29e3cdb..00040f4 100644
--- a/sigc++/macros/signal.h.m4
+++ b/sigc++/macros/signal.h.m4
@@ -51,7 +51,7 @@ ifelse($1,0,[dnl
* @return The slot's return value.
*/
T_return operator()(const slot_type& _A_slot) const
- { return (bitwise_equivalent_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(LIST(_A_slot.rep_, LOOP(_A_a%1_, $1))); }
+ { return (sigc::internal::bitwise_equivalent_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(LIST(_A_slot.rep_, LOOP(_A_a%1_, $1))); }
dnl T_return operator()(const slot_type& _A_slot) const
dnl { return _A_slot(LOOP(_A_a%1_, $1)); }
@@ -150,12 +150,12 @@ FOR(1, $1,[
if (it == slots.end())
return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows:
- r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
+ r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
for (++it; it != slots.end(); ++it)
{
if (it->empty() || it->blocked())
continue;
- r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
+ r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
}
}
@@ -201,12 +201,12 @@ FOR(1, $1,[
if (it == reverse_iterator_type(slots.begin()))
return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows:
- r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
+ r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
for (++it; it != reverse_iterator_type(slots.begin()); ++it)
{
if (it->empty() || it->blocked())
continue;
- r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
+ r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
}
}
@@ -247,7 +247,7 @@ FOR(1, $1,[
{
if (slot.empty() || slot.blocked())
continue;
- (bitwise_equivalent_cast<call_type>(slot.rep_->call_))(LIST(slot.rep_, LOOP(_A_a%1, $1)));
+ (sigc::internal::bitwise_equivalent_cast<call_type>(slot.rep_->call_))(LIST(slot.rep_, LOOP(_A_a%1, $1)));
}
}
@@ -278,7 +278,7 @@ FOR(1, $1,[
{
if (it->empty() || it->blocked())
continue;
- (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
+ (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
}
}
_DEPRECATE_IFDEF_END