os/ossrv/genericopenlibs/cppstdlib/stl/test/compiler/ttei4.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/test/compiler/ttei4.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,41 @@
     1.4 +/*
     1.5 + * It is known that this code not compiled by following compilers:
     1.6 + *   gcc 2.95.3
     1.7 + *   gcc 3.3.3
     1.8 + *   gcc 3.4.1
     1.9 + *
    1.10 + * It is known that this code compiled by following compilers:
    1.11 + *
    1.12 + *   MSVC 6
    1.13 + *   MSVC 8 Beta
    1.14 + */
    1.15 +
    1.16 +/*
    1.17 + * Indeed this code is wrong: 1. explicit template specialization
    1.18 + * have to appear out-of-class; 2. specialized struct C have to
    1.19 + * have function f.
    1.20 + *
    1.21 + */
    1.22 +
    1.23 +struct A
    1.24 +{
    1.25 +  private:
    1.26 +    struct B
    1.27 +    {
    1.28 +        template <typename T>
    1.29 +        static void f( T& ) {}
    1.30 +
    1.31 +        template <bool V>
    1.32 +        struct C
    1.33 +        {
    1.34 +            template <typename T>
    1.35 +            static void f( T& ) {}
    1.36 +        };
    1.37 +
    1.38 +        template <>
    1.39 +        struct C<true>
    1.40 +        {
    1.41 +        };
    1.42 +    };
    1.43 +};
    1.44 +