1// dg-do run 2// Copyright (C) 2005 Free Software Foundation, Inc. 3// Contributed by Nathan Sidwell 16 Sep 2005 <nathan@codesourcery.com> 4 5// PR 23519 template specialization ordering (DR214) 6// Origin: Maxim Yegorushkin <maxim.yegorushkin@gmail.com> 7 8struct A 9{ 10 template<class T> int operator+(T&) { return 1;} 11}; 12 13template<class T> struct B 14{ 15 int operator-(A&) {return 2;} 16 template<typename R> int operator*(R&) {return 3;} 17}; 18 19template <typename T, typename R> int operator-(B<T>, R&) {return 4;} 20template<class T> int operator+(A&, B<T>&) { return 5;} 21template <typename T> int operator*(T &, A&){return 6;} 22 23int main() 24{ 25 A a; 26 B<A> b; 27 if ((a + b) != 5) 28 return 1; 29 30 if ((b - a) != 2) 31 return 2; 32 33 if ((b * a) != 6) 34 return 3; 35} 36