public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103490] New: Linkage type of typeinfo of polymorphic object with OOL functions
@ 2021-11-30  9:48 lizekun.zek at bytedance dot com
  2021-12-20 23:27 ` [Bug c++/103490] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lizekun.zek at bytedance dot com @ 2021-11-30  9:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103490

            Bug ID: 103490
           Summary: Linkage type of typeinfo of polymorphic object with
                    OOL functions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lizekun.zek at bytedance dot com
  Target Milestone: ---

Hi guys,
  I found that the linkage of typeinfo of polymorphic object with OOL-functions
is weak, while that is strong for clang, and I want to attach a patch to make
the behavior of the two compilers consistent. However, I can't find the clear
definition of this in Itanium C++ ABI, so here are the questions:

1.It is easy to understand that we make the object with inlined-functions weak, 
  because it usually appears in a header file and may be defined several times, 
  so when functions are out-of-line, why do we make it weak?

2.In fact, I prefer the gcc way, are there any cases that show gcc is 
  better?

This is a case to show the issue.

---
test.h

class A{
public:
    virtual const int getA(){} ;
    virtual const int getB(){} ;
};

---
testA.cpp

#include<iostream>
#include "test.h"
using namespace std;

class Test : public A {
public:
    virtual const int getA() override;
};
const int Test ::getA() {
    return 1;
}


int main() {
    A * t=new Test();;
    cout << dynamic_cast<Test*>(t);
}
---

testB.cpp

#include "test.h"

class Test : A {
public:
    virtual const int getB() override;
};
const int Test :: getB() {
    return 2;
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-22  7:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  9:48 [Bug c++/103490] New: Linkage type of typeinfo of polymorphic object with OOL functions lizekun.zek at bytedance dot com
2021-12-20 23:27 ` [Bug c++/103490] " pinskia at gcc dot gnu.org
2021-12-21  0:02 ` pinskia at gcc dot gnu.org
2021-12-22  5:04 ` rjmccall at gmail dot com
2021-12-22  7:07 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).