[Bug c++/13714] destructor name `const s' does not match type `const s' of expression

rschiele at uni-mannheim dot de gcc-bugzilla@gcc.gnu.org
Sat Jan 17 00:13:00 GMT 2004


------- Additional Comments From rschiele at uni-mannheim dot de  2004-01-17 00:13 -------
Andrew, I think you are wrong here.  The standard (2003 revision) says in 
section 12.4 paragraph 12: 
 
"In an explicit destructor call, the destructor name appears as a ~ followed 
by a type-name that names the destructor's class type." 
 
As far as I read this sentence, it can be _any_ name that names the class 
type. 
 
There is even an informative example in the same section with code that is 
claimed to be correct C++ code and triggers the same bug. 
 
For those that do not have the standard availlable, the code without the line 
that is commented to be erroneous is: 
 
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(); 
    B_ptr->~B(); 
    B_ptr->~B(); 
    B_ptr->~B_alias(); 
    B_ptr->B_alias::~B(); 
} 

-- 


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



More information about the Gcc-bugs mailing list