Named return values in C++ doesn't work ?

Sylvain Pion Sylvain.Pion@sophia.inria.fr
Tue Sep 29 02:49:00 GMT 1998


Hi,

This great feature I found in the doc doesn't seem to work (with gcc-2.8.1
nor the latest EGCS snapshot).

I expected something like this to compile:

class C
{
  public:
  C (const int d = 0)
  { a = d; }

  C
  operator+(const C & d) return tmp;
  {
    tmp.a += d.a;
    // C tmp (a + d.a);
    // return tmp;
  }
  int a;
};


Do I misunderstand the doc ?

Also, it's a pity (as written in the doc) that we can't specify the exact
location of the constructor.  Is someone working on implementing such a
feature ?

-- 
Sylvain



More information about the Gcc mailing list