view gcc/testsuite/g++.dg/template/conv1.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

// { dg-do compile }

// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2001 <nathan@codesourcery.com>

// PR 4361. Template conversion operators were not overloaded.

template <class T> struct Second;

template<class T> struct First
{
  int Foo ();
  
  template <class U> operator Second<U>();
  template <class U> operator First<U>();
};

template <class T> int First<T>::Foo ()
{ return 0; } // This is here to make sure we didn't smash Foo's decl in the
	      // method vector

struct B { };
struct D { };

void Foo ()
{
  First<B> (First<D>::*pf)() = &First<D>::operator First<B>;
}