This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81973] Aliased virtual methods are treated as undefined, so the vtable is not generated
- From: "blaffablaffa at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 08:35:34 +0000
- Subject: [Bug c++/81973] Aliased virtual methods are treated as undefined, so the vtable is not generated
- Auto-submitted: auto-generated
- References: <bug-81973-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81973
--- Comment #3 from Lorenzo Pistone <blaffablaffa at gmail dot com> ---
That is not the issue, or maybe I don't understand the suggestion. This program
fails just the same:
#include <iostream>
using namespace std;
struct b{
int a;
virtual void f(){
cout<<__PRETTY_FUNCTION__<<' '<<a<<endl;
}
};
struct s : b{
#ifdef VIRT_ALIAS
virtual void f() __attribute__ ((alias ("_ZN1s7f_aliasEv")));
#endif
void g() __attribute__ ((alias ("s_g_alias")));
void f_alias() __attribute__ ((used)) {
cout<<__PRETTY_FUNCTION__<<' '<<a<<endl;
}
};
extern "C"{
void s_g_alias(s* this_){
cout<<__PRETTY_FUNCTION__<<' '<<this_->a<<endl;
}
}
int main(){
s a;
a.a = 123;
a.f();
a.g();
}