This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/29298] New: rejects valid specialization of member template classes


Similar to 14494 and 18950 but for inner classes. This is a stripped-down
example. Workaround appreciated, but has to be class specialization (not member
funtion). 

This works with icc, and is thus a portability issue...

g++-20060930 gives:

%COMP.sh "-g -c -W" member_templates_2.cc
member_templates_2.cc:11: error: explicit specialization in non-namespace scope
'struct sentry<F>'
member_templates_2.cc:11: error: enclosing class templates are not explicitly
specialized
member_templates_2.cc:12: error: template parameters not used in partial
specialization:
member_templates_2.cc:12: error:         'F'


// test

template<typename F>
struct sentry
{
  template<typename T>
  struct metadata
  {
    static int
    foo() { return 5; }
  };

  template<>
  struct metadata<void>
  {
    static int
    foo() { return 6; }
  };
};

int main()
{
  int i1, i2;

  typedef sentry<char> sentry_type;

  i1 = sentry_type::metadata<int>::foo();
  i2 = sentry_type::metadata<void>::foo(); // 6

  return 0;
}


-- 
           Summary: rejects valid specialization of member template classes
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
 GCC build triplet: all
  GCC host triplet: all
GCC target triplet: all


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29298


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]