First of all, sorry if I seem redundant, for you may get a lot of requests like
this one, but couldn't you implement an extension (accessible with, for
example, -ftypedef-templates or something) that would allow the code below to
compile as it logically should : 

template<class _T>
typedef _T Storage; // a template typedef declaration

class I { // an abstract class
  virtual void foo() const=0;
};
template<>
typedef const I& Storage<I>; // a partial specialisation for the abstract class

template<class _T>
class Foo {
  Storage<_T> m_data;
/* obviously the class does something else ;) */
};

int main(/* etc. */) {
  Foo<A>   test;
  Foo<int> test2;

  return 0;
}

Thanks a bunch if you can, and thanks anyway otherwise :D

PS: I know the standard doesn't allow for typedef templates (and that's why I'm
asking for an extension) but this one would be so darn helpful I couldn't help
but ask anyway.

PS2: I know there is a workaround to do this, but it's ugly and it's impact on
readability and design is disastrous, whereas the syntax above is pretty
readable and well in accordance with the whole of template declaration and
specialisation, since its syntax is the same as when I declare a class or a
function template.


-- 
           Summary: Typedef templates
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marc dot coiffier at free dot fr


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

Reply via email to