1 // { dg-do run  }
2 // PRMS Id: g++/6034
3 
4 extern "C" int printf (const char *, ...);
5 
6 class Base
7 {
8 	char x;
9 };
10 
11 template <class T>
12 // remove the public Base inheritance and the problem goes away...
13 class Container : public Base
14 {
15 public:
16 
Container(const T & aValue)17     Container(const T& aValue): myValue(aValue) { }
18 
19     operator const T&(void) const
20     {
21 	printf("Container::const T& called\n");
22 	return myValue;
23     }
24 
25 protected:
26 
27     T myValue;
28 };
29 
30 typedef unsigned short Type;
31 
32 typedef Container<Type> TypeContainer;
33 
main(void)34 int main(void)
35 {
36     TypeContainer myTypeContainer(2);
37     Type t = myTypeContainer;
38 
39     printf ("myType = %d\n", t);
40     return t != 2;
41 }
42