| 1 |
// { dg-do run } |
| 2 |
// Test matching of partial specializations. |
| 3 |
|
| 4 |
template <int* x, int* y> |
| 5 |
class EQUAL { |
| 6 |
public: |
| 7 |
enum { value = 0 }; |
| 8 |
}; |
| 9 |
template <int* x> |
| 10 |
class EQUAL<x,x> { |
| 11 |
public: |
| 12 |
enum { value = 1 }; |
| 13 |
}; |
| 14 |
|
| 15 |
int x; |
| 16 |
int y; |
| 17 |
|
| 18 |
int equals_x_x = EQUAL<&x,&x>::value; // expected value: 1 |
| 19 |
int equals_x_y = EQUAL<&x,&y>::value; // expected value: 0 |
| 20 |
int equals_y_x = EQUAL<&y,&x>::value; // expected value: 0 |
| 21 |
int equals_y_y = EQUAL<&y,&y>::value; // expected value: 1 |
| 22 |
|
| 23 |
int main () |
| 24 |
{ |
| 25 |
if (equals_x_x == 1 |
| 26 |
&& equals_x_y == 0 |
| 27 |
&& equals_y_x == 0 |
| 28 |
&& equals_y_y == 1) |
| 29 |
return 0; |
| 30 |
return 1; |
| 31 |
} |