This is the mail archive of the gcc-bugs@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++/5193: Problem with nested templates instanciation



>Number:         5193
>Category:       c++
>Synopsis:       Problem with nested templates instanciation
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 25 17:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     A. de Maricourt
>Release:        3.0.3
>Organization:
>Environment:
i386-linux
>Description:
xx.cc: In function 'int foo()':
xx.cc:19: no matching function for call to 'aaa<int>::bbb<char*>::bbb(const char[4])'
xx.cc:5: candidates are ...

message is correct, but I was expecting 'aaa<float>::...' instead of 'aaa<int>::...' since Y is bound to float

See source code below

Note 1: I am unable to say if this is related to the two stage lookup feature that you mention, as I don't know what it is and I don't have the C++ specs.

Note 2: this code was isolated from a biger project, previously compiled using gcc 2.95 (didn't work either with 2.95 because I had a 'compiler error'). I expected 3.0 would allow me to rewrite it in a cleaner way.

Sorry if it's already known, or a some misunderstanding from my own.

Best regards,

>How-To-Repeat:
file xx.cc:

template <class A> class aaa {
public:
  template <class B> struct bbb {
  };
};

template <class X, class Y, class Z>
class xxx {
public:
  typedef aaa<Y>::bbb<Z> ccc;
};

void foo (void)
{
  xxx<int,float,char*>::ccc i ("aaa");
}
>Fix:

>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]