C++ feature proposal: specialize conversions for type of usage (local, member, parameter, etc.)

2015-10-11 Thread Aryeh Gregor
In bug 1193762, there's been work on eliminating the implicit conversion from nsCOMPtr to T*, at least for rvalues, to avoid the safety problem discussed there. The problem is that then you can't pass an nsCOMPtr&& to a function that wants a T*, even though this is perfectly safe: the lifetime of

Re: C++ feature proposal: specialize conversions for type of usage (local, member, parameter, etc.)

2015-10-11 Thread Aryeh Gregor
On Sun, Oct 11, 2015 at 2:09 PM, Aryeh Gregor wrote: > A new language feature could be used to solve this: allow conversion > operators to behave differently based on how the variable is declared. > For instance, it might convert differently if the source or > destination is a

Re: C++ feature proposal: specialize conversions for type of usage (local, member, parameter, etc.)

2015-10-11 Thread Eric Rescorla
Note: I'm not taking a position on the language feature, just between your two designs. -Ekr On Sun, Oct 11, 2015 at 5:34 AM, Eric Rescorla wrote: > > On Sun, Oct 11, 2015 at 4:28 AM, Aryeh Gregor wrote: > >> On Sun, Oct 11, 2015 at 2:09 PM, Aryeh Gregor

Re: C++ feature proposal: specialize conversions for type of usage (local, member, parameter, etc.)

2015-10-11 Thread Eric Rescorla
On Sun, Oct 11, 2015 at 4:28 AM, Aryeh Gregor wrote: > On Sun, Oct 11, 2015 at 2:09 PM, Aryeh Gregor wrote: > > A new language feature could be used to solve this: allow conversion > > operators to behave differently based on how the variable is declared. > >