This is the mail archive of the gcc-prs@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]

c++/10574: Partial specialization selection failure involving a default template parameter from inside a template


>Number:         10574
>Category:       c++
>Synopsis:       Partial specialization selection failure involving a default template parameter from inside a template
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 30 23:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Eelis van der Weegen
>Release:        gcc version 3.2.2
>Organization:
>Environment:
Configured with: ../gcc-3.2.2/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
>Description:
Consider the following code:

  template <typename>
  struct A
  {
    struct B {};

    template <typename, typename T = B>
    struct C
    {
      typename T::x y;
    };

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

  A<int>::C<int> t;

The last statement should instantiate C's partial specialization. However, the nonspecialized version is instantiated, resulting in a compiler error:

  no type named `x' in `struct A<int>::B

When considering the specialization, it seems G++ fails to identify the automatically selected default parameter and the formal parameter of the specialization as the same B. Moving B outside A resolves the issue.

Comeau compiles the code without problems.

This problem seems to be related to PR9737, which was suspended due to possible change in the next version of the C++ standard. I think this problem is different enough for examination, especially since the current patch for 9737 does not cover this issue (it deals with template template parameter problems).
>How-To-Repeat:
Try compiling the code from the description.
>Fix:
No idea.
>Release-Note:
>Audit-Trail:
>Unformatted:


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