-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
| Bugzilla Link | 11124 |
| Resolution | FIXED |
| Resolved on | Oct 13, 2011 21:30 |
| Version | 2.9 |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor,@efriedma-quic |
Extended Description
The following C++ code gives a segfault when executed.
struct Base
{
const int text;
Base():text(1) {}
Base(int aText)
: text(aText) {}
};
struct SubA : public virtual Base
{
protected:
int x;
public:
SubA(int aX)
: x(aX) {}
};
class SubB : public virtual Base
{};
struct Diamond : public SubA, public SubB
{
Diamond(int text)
: Base(text), SubA(5), SubB() {}
void printText()
{
if(text != 2)
__builtin_abort();
if(x!=5)
__builtin_abort();
}
};
int main(int, char**)
{
Diamond x(2);
x.printText();
}
Incidentally, the same problem existed as a regression in gcc:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50618
Compilation was done on clang version 2.9 (tags/RELEASE_29/final).
Target: x86_64-unknown-linux-gnu.
Default Arch Linux distribution.