On Mon, Feb 23, 2004 at 03:27:50PM +0100, Lars Gullik Bjønnes wrote:
> this is mine:
> 
> --------------
> #include <utility>
> 
> class tull;
> std::pair<tull, tull> ReturnVar();
> 
> class tull {};
> 
> int main() {
>         std::pair<tull, tull> ptt = ReturnVar();
> }
> 
> std::pair<tull, tull> ReturnVar() {
>         return std::make_pair(tull(), tull());
> }

Looks like I have to change my mind regarding the (il)legality of this code.
Some external helper pointed to:

  8.3.5p6:
  # [...] The type of a parameter or the return type for a function
  # declaration that is not a definition may be an incomplete class
  # type.

So, in fact, this is explicitly allowed...

[Which only leaves the somewhat clumsy use (more typing required both on
user and implementation side) the boost::tie and the extra <utility>
include. All of them 'minor' points, but nevertheless existing and in at
least my opinion outweighing breanking the 'explicit return' dogma]

Andre'

Reply via email to