c++/9057: partial template specialization appears to be ignored

sneechy@hotmail.com sneechy@hotmail.com
Wed Dec 25 07:26:00 GMT 2002


>Number:         9057
>Category:       c++
>Synopsis:       partial template specialization appears to be ignored
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 25 07:26:05 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     sneechy@hotmail.com
>Release:        gcc version 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
gcc version 3.2 (mingw special 20020817-1)
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
>Description:
Compiling the following code:

  template <typename T>
  struct A
  {
    template <int, typename U>
    struct B;

    enum { i = 0 };

    template <typename U>
    struct B<i, U> {};
  };

  int j = sizeof(A<void>::B<0, void>);

results in the following error (on the 'int j = ..' line):

  `sizeof' applied to incomplete type `A<void>::B<0, void>'

I've lozalized and simplified the problem as much as I could. Everything that is left somehow contributes to the conditions that create this problem. Somehow the B partial specialization appears to be ignored because it was specialized using an enumeration value from this particular context. G++ does accept the code if the enumeration is moved outside A.

Comeau compiles the code without problems.
>How-To-Repeat:
See description.
>Fix:
No idea.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list