public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55367] New: Probably problem with c++ vptr under templates and multiple ihenritance
@ 2012-11-17 16:22 wriabi at email dot com
  2012-11-17 23:21 ` [Bug c++/55367] Probably problem with c++ vptr under templates and multiple inheritance paolo.carlini at oracle dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: wriabi at email dot com @ 2012-11-17 16:22 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55367
           Summary: Probably problem with c++ vptr under templates and
                    multiple ihenritance
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wriabi@email.com


Created attachment 28720
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28720
code snippet

Hello,
I have some code that compile and work fine in gcc 4.6.2 (without tne new
keyword "override" ) but in version 4.7.2 it complie generate access violation
runtime. under windows platform.

So, i need some help, thank you very much:

#include <iostream>
using namespace std;

struct Entity {
    //~Entity() = default; //work fine
    ~Entity() {} //when i specified my destructor this compile but generate
runtime access viloation
};

template<typename T>
struct IRepository { virtual T g() = 0; };

struct OtherInterface{ virtual void y() = 0; };

struct IEntityRepository : public virtual IRepository<Entity>{ };

template<typename T>
struct RepositoryBase : public virtual IRepository<T>, public OtherInterface{
    virtual void y()  override { cout << "y() override called" << endl; }
};

template<typename T>
struct DataRepository : public RepositoryBase<T>{
    virtual T f() { cout << "f() called" << endl; this->y(); T t; return t; }
        T g() override {
        cout << "g() override called" << endl;
        ////when i specified my destructor for class Entity this compile but
generate runtime access viloation here : on this: probably problem with vptr
        return this->f(); }
};

struct EffectiveEntityRepository : public DataRepository<Entity>, public
IEntityRepository{
};

int main() {
    IEntityRepository* var = new EffectiveEntityRepository();
    var->g();
    return 1;
}


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

end of thread, other threads:[~2012-11-24 11:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-17 16:22 [Bug c++/55367] New: Probably problem with c++ vptr under templates and multiple ihenritance wriabi at email dot com
2012-11-17 23:21 ` [Bug c++/55367] Probably problem with c++ vptr under templates and multiple inheritance paolo.carlini at oracle dot com
2012-11-18 14:05 ` paolo.carlini at oracle dot com
2012-11-18 19:41 ` wriabi at email dot com
2012-11-18 19:43 ` wriabi at email dot com
2012-11-18 19:47 ` pluto at agmk dot net
2012-11-18 21:05 ` paolo.carlini at oracle dot com
2012-11-19 19:48 ` wriabi at email dot com
2012-11-23 21:51 ` paolo.carlini at oracle dot com
2012-11-23 21:57 ` paolo.carlini at oracle dot com
2012-11-24 11:52 ` ktietz 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).