1 // { dg-do compile } 2 3 // Copyright (C) 2003 Free Software Foundation, Inc. 4 // Contributed by Nathan Sidwell 21 Mar 2003 <nathan@codesourcery.com> 5 6 // PR 9898, DR 322. Conversion to reference type. 7 8 template <typename> struct Ref {}; 9 template <typename> struct Val {}; 10 11 struct Wrapper 12 { 13 template <typename U> operator Ref<U> & (); 14 template <typename U> operator Val<U> (); 15 }; 16 Foo(Wrapper l)17void Foo (Wrapper l) 18 { 19 static_cast <Ref<int> &> (l); 20 static_cast <Ref<int> const &> (l); 21 static_cast <Ref<int> > (l); 22 static_cast <Val<int> const &> (l); 23 static_cast <Val<int> > (l); 24 } 25