This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15341] New: Type "transformation" in nested templates
- From: "chgros+bugzilla at stanford dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 May 2004 03:17:48 -0000
- Subject: [Bug c++/15341] New: Type "transformation" in nested templates
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040429)
The following code doesn't compile, it seems a pair (of ints) is "transformed"
into an int.
I also tried g++-3.2 (same error), g++-2.95 (internal compiler error).
Here's the offending code:
template <typename t1, typename t2> struct pair
{
t1 first;
t2 second;
};
template <typename X> struct manager
{
typedef X managed_type;
template <typename Y> struct Concept
{
void constraints()
{
Y::del(x);
}
managed_type x;
};
};
template <typename X> struct trivial_manager:public manager<X>
{
static void del(const X &x){}
};
template <typename t1, typename t2, typename manager_t> struct
test1
{
typedef pair<t1, t2> pair_type;
typedef manager< pair_type > manager_test;
manager_test::Concept<manager_t> c;
pair_type x;
};
int main(int argc, char **argv)
{
typedef pair<int, int> pair_type;
test1<int, int, trivial_manager<pair_type > >
m2;
m2.c.constraints();// This doesn't work
typedef manager< pair_type > manager_test;
manager_test::Concept<trivial_manager<pair<int,int> > > c;
c.constraints();// But this does
return 0;
}
Here's the error message:
bug.cpp: In member function `void manager<X>::Concept<Y>::constraints() [with Y
= trivial_manager<main(int, char**)::pair_type>, X = int]':
bug.cpp:39: instantiated from here
bug.cpp:14: error: no matching function for call to `trivial_manager<main(int,
char**)::pair_type>::del(int&)'
bug.cpp:22: error: candidates are: static void trivial_manager<X>::del(const
X&) [with X = main(int, char**)::pair_type]
a
The "del(int&)" should really be a del(pair<int,int>&)
--
Summary: Type "transformation" in nested templates
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: chgros+bugzilla at stanford dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15341