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