--- Comment #5 from bangerth at dealii dot org 2006-10-12 01:50 ---
gcc is correct. It is true that the result of the ?: operator is
a reference to the Base object of the Derived object created in the
second arm. However, the result is an rvalue, and a constant reference
is initialized w
--- Comment #1 from pinskia at gcc dot gnu dot org 2006-06-26 18:16 ---
Here is what is happening currently with GCC:
Base ctor...
Derived ctor...
Base copy ctor...
~Derived called...
~Base called...
Base show called...
~Base called...
So you missed the copy constructor, now I don't kno
--- Comment #2 from pinskia at gcc dot gnu dot org 2006-06-26 18:18 ---
Note ICC produces:
Base ctor...
Derived ctor...
~Derived called...
~Base called...
Base show called...
which might be just as bad.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28169
--- Comment #3 from joseph dot rajesh at gmail dot com 2006-06-27 04:09
---
No I haven't missed the copy constructor... I checked the working with copy
constructor also...
I know g++ is doing a conversion and making a copy of type "Base" (Using Base
copy constructor)... that's why the
--- Comment #4 from joseph dot rajesh at gmail dot com 2006-06-27 07:38
---
The intel compiler version 9.1 gave me the following output
Base ctor...
Derived ctor...
Base COPTY ctor...
Base COPTY ctor...
~Base called...
~Derived called...
~Base called...
Base show called...
~Base called