Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/template/unify1.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // Test non-type template argument folding. | |
2 // Origin: smacdonald@seimac.com | |
3 | |
4 // { dg-do compile } | |
5 | |
6 template < int I1, int I2 > | |
7 class unit | |
8 { | |
9 public: | |
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 | |
20 int main() | |
21 { | |
22 const unit<1,0> u1; | |
23 const unit<2,0> u2; | |
24 | |
25 unit<-1,0> u3( u1 / u2 ); | |
26 } |