| 1 |
// PR c++/68948 |
| 2 |
|
| 3 |
struct B { B (); B (int); }; |
| 4 |
|
| 5 |
struct Time : B { }; |
| 6 |
|
| 7 |
/* Here, A and B are unrelated types. */ |
| 8 |
|
| 9 |
template <typename> |
| 10 |
struct A |
| 11 |
{ |
| 12 |
void TestBody () |
| 13 |
{ |
| 14 |
B::B (); // { dg-error "cannot call constructor .B::B." } |
| 15 |
B::B::B (); // { dg-error "cannot call constructor .B::B." } |
| 16 |
B::B (0); // { dg-error "cannot call constructor .B::B." } |
| 17 |
} |
| 18 |
}; |
| 19 |
|
| 20 |
/* Here, C is (indirectly) derived from B. */ |
| 21 |
|
| 22 |
template <typename g> |
| 23 |
struct C : Time |
| 24 |
{ |
| 25 |
void TestBody () |
| 26 |
{ |
| 27 |
B::B (); // { dg-error "cannot call constructor .B::B." } |
| 28 |
B::B::B (); // { dg-error "cannot call constructor .B::B." } |
| 29 |
B::B (0); // { dg-error "cannot call constructor .B::B." } |
| 30 |
Time::B (0); |
| 31 |
} |
| 32 |
}; |
| 33 |
|
| 34 |
int |
| 35 |
main (void) |
| 36 |
{ |
| 37 |
A<int> a; |
| 38 |
C<int> c; |
| 39 |
a.TestBody (); |
| 40 |
c.TestBody (); |
| 41 |
} |