blob: bbfd58f5c348daf7db991e23cd66c80d54280728 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// PR c++/50618
// { dg-do run }
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();
}
|