c++/9737: Partial template specialisation selection failure involving template parameter defaults

gccbugs@contacts.eelis.net gccbugs@contacts.eelis.net
Mon Feb 17 23:26:00 GMT 2003


>Number:         9737
>Category:       c++
>Synopsis:       Partial template specialisation selection failure involving template parameter defaults
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 17 23:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     gccbugs@contacts.eelis.net
>Release:        gcc version 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
>Description:
G++ fails to perform correct partial template specialisation selection when the template parameter either depends on or is equal to a default type or value:

// a simple template:

  template <typename> struct T {};

// two partial specializations:

  template <template <typename> class A, typename B>
  struct T<A<B> > {};

  template <template <typename, typename> class A, typename B, typename C>
  struct T<A<B, C> > {};

// the subject type that we will try to match (note the default):

  template <typename, typename A = void> struct P;

// now let's try to instantiate T with P:

  T<P<float, int > > a; // ok
  T<P<float, void> > b; // ambiguous instantiation
  T<P<float      > > c; // ambiguous instantiation

Comeau has no problems compiling any of this.
>How-To-Repeat:
Try compiling the code from the description.
>Fix:
No idea.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list