1// Test non-type template argument folding. 2// Origin: smacdonald@seimac.com 3 4// { dg-do compile } 5 6template < int I1, int I2 > 7class unit 8{ 9public: 10 unit() {} 11 unit( const unit<I1,I2>& ) {} 12 13 template< int Q1, int Q2 > 14 unit< I1 - Q1, I2 - Q2 > operator / ( const unit< Q1, Q2 >& rhs ) const { 15 return unit< I1 - Q1, I2 - Q2 >(); 16 } 17 18}; 19 20int main() 21{ 22 const unit<1,0> u1; 23 const unit<2,0> u2; 24 25 unit<-1,0> u3( u1 / u2 ); 26} 27