| 1 |
// { dg-do assemble } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } } |
| 3 |
// GROUPS passed old-abort |
| 4 |
/* |
| 5 |
I received the following message when using g++ (version 2.3.3): |
| 6 |
|
| 7 |
main.cc: In method 'Implicit<implicit<INTEGER,2>,3>::Implicit()': |
| 8 |
main.cc: Internal compiler error 241. |
| 9 |
main.cc: Please report this to '[email protected]' |
| 10 |
*/ |
| 11 |
|
| 12 |
#include <iostream> |
| 13 |
|
| 14 |
class INTEGER { |
| 15 |
int x; |
| 16 |
public: |
| 17 |
typedef int BASE; |
| 18 |
INTEGER(int y) : x(y) {} |
| 19 |
INTEGER() {} |
| 20 |
void encode() { std::cout << "Integer encoder";} |
| 21 |
int operator=(int y) { x=y; return x; } |
| 22 |
operator int() {return x; } |
| 23 |
}; |
| 24 |
|
| 25 |
template< class T, int n> class Implicit : public T { |
| 26 |
public: |
| 27 |
typedef typename T::BASE BASE; |
| 28 |
Implicit(BASE value ): T(value) {} |
| 29 |
Implicit() : T() {} |
| 30 |
int myTag() { return n; } |
| 31 |
void encode() { T::encode(); } |
| 32 |
BASE operator=(BASE t) { return T::operator=(t); } |
| 33 |
}; |
| 34 |
|
| 35 |
int |
| 36 |
main() |
| 37 |
{ |
| 38 |
Implicit<Implicit<INTEGER, 2> , 3> y; |
| 39 |
|
| 40 |
y = 10; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|