[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
g++ question
From: |
James Cowan |
Subject: |
g++ question |
Date: |
Sat, 18 Nov 2000 21:13:30 -0000 |
Hi
I am returning to some c++ programming and am puzzled by g++'s complaints
about conversion of rvalues to references.
I would expect the example below to generate a warning but not an error -
earlier version of g++ did this.
Is there a compiler flag that suppresses this problem?
James
class A
{
public:
A() {}
};
class B
{
public:
B() {}
A returnA()
{
A a;
return a;
}
};
class C
{
public:
C() {}
void test()
{
B b;
A &a = b.returnA();
}
};
Test.cpp: In method `void C::test()':
Test.cpp:29: warning: initialization of non-const reference `class A &' from
rva
lue `A'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- g++ question,
James Cowan <=