>From: "Paul Mensonides" <[EMAIL PROTECTED]>

> From: "David Abrahams" <[EMAIL PROTECTED]>
>
> > >> Here's an interesting turn-of-the-tables: I was experimenting with
> > >> using SFINAE to disable conversion operators, and I discovered that
> > >> almost every compiler except vc6/7 rejects this code:
> > >>
> > >> template <class T> struct voidify { typedef void type; };
> > >> template <class T> struct Y {};
> > >> struct X
> > >> {
> > >>     template <class T>
> > >>     operator Y<T> (typename voidify<T>::type) const { return
Y<T>(); }
> > >> };
> > >
> > > Is this even legal?  I.e. for a user-defined conversion operator to
have
> any
> > > arguments at all?
> >
> > Look twice; the argument is void.
>
> I know, but I don't think you can derive a 'void' parameter list that way.

<snip>

> In other words, the "void" parameter list is fundamentally different than
> "type void".

It appears this is right. 8.3.5/2 says: "[...] If the
parameter-declaration-clause is empty, the function takes no arguments. The
parameter list (void) is equivalent to the empty parameter list. Except for
this special case, void shall not be a parameter type (though types derived
from void, such as void*, can)."

So it seems only "void" can be used, not any type expression that evaluates
to void.


Regards,

Terje

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to