This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/46626] [4.6 Regression] simple use of virtual methods causes pure virtual method call in c++0x mode


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

--- Comment #8 from Roman Kononov <roman at binarylife dot net> 2010-12-25 01:49:05 UTC ---
With the patch applied to r168236:

$ cat test.cpp 
struct X {
    virtual int& x(int&)=0;
    virtual ~X() {}
};

struct Y {
    virtual int& y(int&)=0;
    virtual ~Y() {}
};

struct Z: X, Y {
    int& x(int&);
    int& y(int&);
};

void func() {
    Z z;
}

$ g++ -c -std=c++0x test.cpp
test.cpp: In function 'void func()':
test.cpp:17:7:   in constexpr expansion of 'z.Z::Z()'
test.cpp:17:7: internal compiler error: in cxx_eval_bare_aggregate, at
cp/semantics.c:6352
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Without the patch, with the same test.cpp:

$ g++ -c -std=c++0x test.cpp; echo $?
0

Without the patch, with slightly different test1.cpp:

0 rk@wata:~/tmp/qqq>cat test1.cpp 
struct X {
    virtual int& x(int&)=0;
//  virtual ~X() {}
};

struct Y {
    virtual int& y(int&)=0;
//  virtual ~Y() {}
};

struct Z: X, Y {
    int& x(int&);
    int& y(int&);
};

void func() {
    Z z;
}

0 rk@wata:~/tmp/qqq>g++ -c -std=c++0x test1.cpp
test1.cpp: In function 'void func()':
test1.cpp:17:7:   in constexpr expansion of 'z.Z::Z()'
test1.cpp:17:7: internal compiler error: in cxx_eval_bare_aggregate, at
cp/semantics.c:6338
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]