Skip to content

Commit 3fffd5f

Browse files
committed
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 ACL (argument-dependent lookup).
1 parent ecfa7c2 commit 3fffd5f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

sigc++/functors/slot.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ namespace internal
4040
*
4141
* When reinterpret_cast causes a compiler warning or error, this function
4242
* may work. Intended mainly for conversion between different types of pointers.
43+
*
44+
* Qualify calls with namespace names: sigc::internal::bitwise_equivalent_cast<>().
45+
* If you don't, indirect calls from another library that also contains a
46+
* bitwise_equivalent_cast<>() (perhaps glibmm), can be ambiguous due to ADL
47+
* (argument-dependent lookup).
4348
*/
4449
template <typename out_type, typename in_type>
4550
inline out_type bitwise_equivalent_cast(in_type in)
@@ -153,7 +158,7 @@ struct slot_call
153158
/** Forms a function pointer from call_it().
154159
* @return A function pointer formed from call_it().
155160
*/
156-
static hook address() { return bitwise_equivalent_cast<hook>(&call_it); }
161+
static hook address() { return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
157162
};
158163

159164
} /* namespace internal */
@@ -211,7 +216,7 @@ class slot<T_return(T_arg...)> : public slot_base
211216
inline T_return operator()(type_trait_take_t<T_arg>... a) const
212217
{
213218
if (!empty() && !blocked()) {
214-
return std::invoke(internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_), slot_base::rep_, a...);
219+
return std::invoke(sigc::internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_), slot_base::rep_, a...);
215220
}
216221

217222
return T_return();

sigc++/signal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@ struct signal_emit<T_return, void, T_arg...>
322322
return T_return();
323323
}
324324

325-
r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(it->rep_, a...);
325+
r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(it->rep_, a...);
326326
for (++it; it != slots.end(); ++it)
327327
{
328328
if (it->empty() || it->blocked())
329329
continue;
330-
r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(it->rep_, a...);
330+
r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(it->rep_, a...);
331331
}
332332
}
333333

@@ -365,7 +365,7 @@ struct signal_emit<void, void, T_arg...>
365365
if (slot.empty() || slot.blocked())
366366
continue;
367367

368-
(bitwise_equivalent_cast<call_type>(slot.rep_->call_))(slot.rep_, a...);
368+
(sigc::internal::bitwise_equivalent_cast<call_type>(slot.rep_->call_))(slot.rep_, a...);
369369
}
370370
}
371371
};

0 commit comments

Comments
 (0)