[forwarded from http://bugs.debian.org/269513]


Gcc 3.3 and gcc 3.4 both give the error message "error: `type' is not
a member of `outer<dummy>::inner<dummy<int> >'" when trying to compile
the following:

template<typename dummy_var>
struct dummy { };

template<template<typename> class outer_func>
struct outer {
  template<typename inner_var>
  struct inner { };
  
  template<typename dummy_var>
  struct inner<outer_func<dummy_var> > { typedef dummy_var type; };
};


int main(){
  outer<dummy>::inner<dummy<int> >::type var = 0;

  return var;
}

Both cxx (Digital's compiler) and icc (Intel's compiler) have no such
problem.  It appears that gcc does not properly match against the
specialized inner struct in this case (i.e. it fails to match when the
specialized parameter is based on a template template parameter of an
enclosing struct).

-T

PS: Note that the following version (which contains an even more
explicit specialization) also does not work with gcc (and also does
work with both cxx and icc):

template<template<typename> class outer_func>
struct outer {
  template<typename inner_var, typename dummy=void>
  struct inner { };
  
  template<typename dummy>
  struct inner<outer_func<int>,dummy> { typedef int type; };
};

-- 
           Summary: Template template specialization matching problem
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to