------- Additional Comments From lpadovan at cs dot unibo dot it  2004-11-13 
17:52 -------
I'm experiencing a problem with 

  g++-3.4 (GCC) 3.4.2 (Debian 3.4.2-3)

which seems related to this bug, at least because the error message is similar
and the operator ?: is involved. Here is the program that shows the problem:

class V;

template <class P>
struct S
{
        S(P* p) : ptr(p) { }
        operator P*() const { return ptr; }
        P* ptr;
};

template <class P>
struct A
{
        S<V> f(const S<V>& x) { return (x ? x : (x ? x : 0)); }
};

and the error is:

a.cc: In member function `S<V> A<P>::f(const S<V>&)':
a.cc:14: error: non-lvalue in unary `&'
a.cc:14: error: could not convert `x' to `bool'

In

  g++ (GCC) 3.3.5 (Debian 1:3.3.5-2)

the same program is compiled correctly.

Unfortunately I'm unable to test the program with the latest version of the g++
compiler, so please accept my apologies if this has been solved already.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9440

Reply via email to