Skip to content

Commit 927d754

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 ADL (argument-dependent lookup).
1 parent 0d8f3cc commit 927d754

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

sigc++/functors/macros/slot.h.m4

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ FOR(1, $1,[
6363
inline T_return operator()(LOOP(arg%1_type_ _A_a%1, $1)) const
6464
{
6565
if (!empty() && !blocked())
66-
return (internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(LIST(slot_base::rep_, LOOP(_A_a%1, $1)));
66+
return (sigc::internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(LIST(slot_base::rep_, LOOP(_A_a%1, $1)));
6767
return T_return();
6868
}
6969
@@ -355,7 +355,7 @@ ifelse($1,0,[
355355
* @return A function pointer formed from call_it().
356356
*/
357357
static hook address()
358-
{ return bitwise_equivalent_cast<hook>(&call_it); }
358+
{ return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
359359
};
360360
361361
])
@@ -385,6 +385,11 @@ namespace internal {
385385
*
386386
* When reinterpret_cast causes a compiler warning or error, this function
387387
* may work. Intended mainly for conversion between different types of pointers.
388+
*
389+
* Qualify calls with namespace names: sigc::internal::bitwise_equivalent_cast<>().
390+
* If you don't, indirect calls from another library that also contains a
391+
* bitwise_equivalent_cast<>() (perhaps glibmm), can be ambiguous due to ADL
392+
* (argument-dependent lookup).
388393
*/
389394
template <typename out_type, typename in_type>
390395
inline out_type bitwise_equivalent_cast(in_type in)
@@ -502,7 +507,7 @@ struct slot_call
502507
* @return A function pointer formed from call_it().
503508
*/
504509
static hook address()
505-
{ return bitwise_equivalent_cast<hook>(&call_it); }
510+
{ return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
506511
};
507512

508513
/** Abstracts functor execution.
@@ -534,7 +539,7 @@ struct slot_call<T_functor, T_return>
534539
* @return A function pointer formed from call_it().
535540
*/
536541
static hook address()
537-
{ return bitwise_equivalent_cast<hook>(&call_it); }
542+
{ return sigc::internal::bitwise_equivalent_cast<hook>(&call_it); }
538543
};
539544

540545
} /* namespace internal */
@@ -594,7 +599,7 @@ public:
594599
inline T_return operator()(type_trait_take_t<T_arg>... _A_a) const
595600
{
596601
if (!empty() && !blocked())
597-
return (internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
602+
return (sigc::internal::bitwise_equivalent_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
598603
return T_return();
599604
}
600605

sigc++/macros/signal.h.m4

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ifelse($1,0,[dnl
5151
* @return The slot's return value.
5252
*/
5353
T_return operator()(const slot_type& _A_slot) const
54-
{ return (bitwise_equivalent_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(LIST(_A_slot.rep_, LOOP(_A_a%1_, $1))); }
54+
{ return (sigc::internal::bitwise_equivalent_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(LIST(_A_slot.rep_, LOOP(_A_a%1_, $1))); }
5555
dnl T_return operator()(const slot_type& _A_slot) const
5656
dnl { return _A_slot(LOOP(_A_a%1_, $1)); }
5757
@@ -150,12 +150,12 @@ FOR(1, $1,[
150150
if (it == slots.end())
151151
return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows:
152152
153-
r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
153+
r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
154154
for (++it; it != slots.end(); ++it)
155155
{
156156
if (it->empty() || it->blocked())
157157
continue;
158-
r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
158+
r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
159159
}
160160
}
161161
@@ -201,12 +201,12 @@ FOR(1, $1,[
201201
if (it == reverse_iterator_type(slots.begin()))
202202
return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows:
203203
204-
r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
204+
r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
205205
for (++it; it != reverse_iterator_type(slots.begin()); ++it)
206206
{
207207
if (it->empty() || it->blocked())
208208
continue;
209-
r_ = (bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
209+
r_ = (sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
210210
}
211211
}
212212
@@ -247,7 +247,7 @@ FOR(1, $1,[
247247
{
248248
if (slot.empty() || slot.blocked())
249249
continue;
250-
(bitwise_equivalent_cast<call_type>(slot.rep_->call_))(LIST(slot.rep_, LOOP(_A_a%1, $1)));
250+
(sigc::internal::bitwise_equivalent_cast<call_type>(slot.rep_->call_))(LIST(slot.rep_, LOOP(_A_a%1, $1)));
251251
}
252252
}
253253
@@ -278,7 +278,7 @@ FOR(1, $1,[
278278
{
279279
if (it->empty() || it->blocked())
280280
continue;
281-
(bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
281+
(sigc::internal::bitwise_equivalent_cast<call_type>(it->rep_->call_))(LIST(it->rep_, LOOP(_A_a%1, $1)));
282282
}
283283
}
284284
_DEPRECATE_IFDEF_END

0 commit comments

Comments
 (0)