public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29830] New: Name lookup bug for inner template specialization
@ 2006-11-14 12:48 zjasz at yahoo dot com
2006-11-14 12:53 ` [Bug c++/29830] " pluto at agmk dot net
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: zjasz at yahoo dot com @ 2006-11-14 12:48 UTC (permalink / raw)
To: gcc-bugs
Hi,
I haven't found any related bug in the known bugs database.
Also I posted this problem to several forums to be shore that this code doesn't
violate the C++ standard. ~60% replies that this should work. Moreover two
other compilers can compile without any problem:
The simplified code:
//////////////////////////////////
#include <stdio.h>
template <typename T, int v> class record_descriptor {
public:
void operator()()
{
printf("Global template\n");
}
};
template<typename T, int v, template<typename,int> class RD =
record_descriptor> class TableRecord {
public:
TableRecord()
{
RD<T, v> d;
d();
}
};
template<typename A> class Attr
{
public:
template <typename T, int v> class i_record_descriptor
{
};
template <int v> class i_record_descriptor<A, v>
{
public:
void operator()()
{
printf("Inner spec template\n");
}
};
Attr()
{
TableRecord<A, 1, i_record_descriptor> tr;
}
};
int main()
{
Attr<int> attr;
return 0;
}
//////////////////////////////
Message:
gccbug.cpp: In constructor 'TableRecord<T, v, RD>::TableRecord() [with T = int,
int v = 1, RD = Attr<int>::i_record_descriptor]':
gccbug.cpp:32: instantiated from 'Attr<A>::Attr() [with A = int]'
gccbug.cpp:37: instantiated from here
gccbug.cpp:15: error: no match for call to
'(Attr<int>::i_record_descriptor<int, 1>) ()'
--------------------------------------------------------
If i_class_descriptor template has an implementation:
//////////////////////////////////////////////////////
#include <stdio.h>
template <typename T, int v> class record_descriptor {
public:
void operator()()
{
printf("Global template\n");
}
};
template<typename T, int v, template<typename,int> class RD =
record_descriptor> class TableRecord {
public:
TableRecord()
{
RD<T, v> d;
d();
}
};
template<typename A> class Attr
{
public:
template <typename T, int v> class i_record_descriptor
{
public:
void operator()()
{
printf("Inner template\n");
}
};
template <int v> class i_record_descriptor<A, v>
{
public:
void operator()()
{
printf("Inner spec template\n");
}
};
Attr()
{
TableRecord<A, 1, i_record_descriptor> tr;
}
};
int main()
{
Attr<int> attr;
return 0;
}
/////////////////////////////////////////////////////
...compiles but the result after executing is "Inner template" instead of
"Inner spec template"
If the parameter 'A' is changed in the partial specialozation to a primitve
type, ex: 'int' then compiles fine and the result is correct.
The last version I tried was:
g++ (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)
I hope I give you all the necessary information!
Regards,
Zoltan Jasz
Software developer,
Ericsson Telecomunication Hungary Ltd.
--
Summary: Name lookup bug for inner template specialization
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: zjasz at yahoo dot com
GCC build triplet: 4.1.1 20060525 (Red Hat 4.1.1-1)
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29830
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/29830] Name lookup bug for inner template specialization
2006-11-14 12:48 [Bug c++/29830] New: Name lookup bug for inner template specialization zjasz at yahoo dot com
@ 2006-11-14 12:53 ` pluto at agmk dot net
2006-11-14 15:02 ` zjasz at yahoo dot com
2006-11-14 16:31 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pluto at agmk dot net @ 2006-11-14 12:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pluto at agmk dot net 2006-11-14 12:53 -------
this is a dup of PR29767
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29830
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/29830] Name lookup bug for inner template specialization
2006-11-14 12:48 [Bug c++/29830] New: Name lookup bug for inner template specialization zjasz at yahoo dot com
2006-11-14 12:53 ` [Bug c++/29830] " pluto at agmk dot net
@ 2006-11-14 15:02 ` zjasz at yahoo dot com
2006-11-14 16:31 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: zjasz at yahoo dot com @ 2006-11-14 15:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from zjasz at yahoo dot com 2006-11-14 15:02 -------
(In reply to comment #1)
> this is a dup of PR29767
Sorry for duplication, I haven't checked again after I posted to the gcc-help.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29830
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/29830] Name lookup bug for inner template specialization
2006-11-14 12:48 [Bug c++/29830] New: Name lookup bug for inner template specialization zjasz at yahoo dot com
2006-11-14 12:53 ` [Bug c++/29830] " pluto at agmk dot net
2006-11-14 15:02 ` zjasz at yahoo dot com
@ 2006-11-14 16:31 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-14 16:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-11-14 16:30 -------
*** This bug has been marked as a duplicate of 14032 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29830
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-14 16:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14 12:48 [Bug c++/29830] New: Name lookup bug for inner template specialization zjasz at yahoo dot com
2006-11-14 12:53 ` [Bug c++/29830] " pluto at agmk dot net
2006-11-14 15:02 ` zjasz at yahoo dot com
2006-11-14 16:31 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).