author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
/* |
sl@0 | 2 |
* It is known that this code not compiled by following compilers: |
sl@0 | 3 |
* gcc 2.95.3 |
sl@0 | 4 |
* gcc 3.3.3 |
sl@0 | 5 |
* gcc 3.4.1 |
sl@0 | 6 |
* |
sl@0 | 7 |
* It is known that this code compiled by following compilers: |
sl@0 | 8 |
* |
sl@0 | 9 |
* MSVC 6 |
sl@0 | 10 |
* MSVC 8 Beta |
sl@0 | 11 |
*/ |
sl@0 | 12 |
|
sl@0 | 13 |
/* |
sl@0 | 14 |
* Indeed this code is wrong: 1. explicit template specialization |
sl@0 | 15 |
* have to appear out-of-class; 2. specialized struct C have to |
sl@0 | 16 |
* have function f. |
sl@0 | 17 |
* |
sl@0 | 18 |
*/ |
sl@0 | 19 |
|
sl@0 | 20 |
struct A |
sl@0 | 21 |
{ |
sl@0 | 22 |
private: |
sl@0 | 23 |
struct B |
sl@0 | 24 |
{ |
sl@0 | 25 |
template <typename T> |
sl@0 | 26 |
static void f( T& ) {} |
sl@0 | 27 |
|
sl@0 | 28 |
template <bool V> |
sl@0 | 29 |
struct C |
sl@0 | 30 |
{ |
sl@0 | 31 |
template <typename T> |
sl@0 | 32 |
static void f( T& ) {} |
sl@0 | 33 |
}; |
sl@0 | 34 |
|
sl@0 | 35 |
template <> |
sl@0 | 36 |
struct C<true> |
sl@0 | 37 |
{ |
sl@0 | 38 |
}; |
sl@0 | 39 |
}; |
sl@0 | 40 |
}; |
sl@0 | 41 |