This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.6 branch] Issue with C++ references.


On 10/18/2011 09:57 AM, Yvan ROUX wrote:
int main() {
         const int Ci = 0;
         const int&rCi = Ci;
         if (!(&Ci ==&rCi)) return 1;
         return 0;
}

The program has the expected behaviour if you use a 4.5 gcc or the trunk, but
if you compile it with a 4.6 one (even with the branch's head) with -O0,
the program returns the 1 value, because rCi is not bound to Ci, but to an
anonymous temporary which cantains the value 0.

Eep!


In fact only the part of the commit which removes the call to
maybe_constant_value in cp_parser_initializer_clause fixes the bug.
I'm not really sure of what I have to do in such a case :
preparing the patch or asking to backport Jason's on the 4.6 branch ?

I'll backport that hunk, thanks for catching this.


Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]