Standard Conformance with GCC and the C++ 2003 standard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am interested in an example from the C++ 2003 standard pg 197.

The specific example is thus:

struct B {
virtual ~B() { }
};
struct D : B {
~D() { }
};
D D_object;
typedef B B_alias;
B* B_ptr = &D_object;
void f() {
D_object.B::~B(); // calls B's destructor
B_ptr->~B(); //calls D's destructor
B_ptr->~B_alias(); // calls D's destructor
B_ptr->B_alias::~B(); // calls B's destructor
B_ptr->B_alias::~B_alias(); // error, no B_alias in class B
}

The example signifies that the last line is an error.

However with the latest SVN gcc it is not an error.

On the same page of the standard this example is present.

typedef int I;

int main()
{
I* p;
p->I::~I();
}

It seems that for the second example to complie cleanly that it must be inferred that for the last line in the first example it should also compile cleanly (which it does).

Is this apparent contradiction in GCC or the way in which the 2003 C++ standard is phrased in this case?
For the first example , last line is this definatively an error or not?

Regards,

JT

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux