Explicit and partial template specialization nested in classes.

Discussion in 'C++' started by Patrick Kowalzick, Oct 29, 2004.

  1. Dear all,

    the following code is illegeal (but compiles with MSVC 7.1):

    // *** illegal ***
    struct outer0 {
    template<typename inner_var>
    struct inner { };

    template<>
    struct inner<void> { };
    };
    // ***

    but is the following legal (compiles with g++, comeau, MSVC7.1) ?

    // *** legal ***
    struct outer0 {
    template<typename inner_var, typename hack = void>
    struct inner { };

    template<typename hack>
    struct inner<void,hack> { };
    };
    // ***

    Example copied from:
    http://lists.debian.org/debian-gcc/2004/09/msg00015.html

    There I found as well:
    > In an explicit specialization declaration for a member of a class
    > template or a member template that appears in namespace scope, the
    > member template and some of its enclosing class templates may remain
    > unspecialized, except that the declaration shall not explicitly
    > specialize a class member template if its enclosing class templates
    > are not explicitly specialized as well.


    but it does not tell if its legal :(.

    Regards,
    Patrick
    Patrick Kowalzick, Oct 29, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy
    Replies:
    5
    Views:
    497
    Shezan Baig
    Jan 30, 2005
  2. Ferdi Smit
    Replies:
    8
    Views:
    2,500
  3. toton
    Replies:
    1
    Views:
    607
  4. Christof Warlich
    Replies:
    7
    Views:
    1,076
    Christof Warlich
    Mar 16, 2008
  5. vj
    Replies:
    1
    Views:
    476
Loading...

Share This Page