public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39458] New: function template in template class cant be called from other template class
@ 2009-03-13 15:56 mrpugh at gmx dot de
2009-03-13 16:04 ` [Bug c++/39458] " ruben at lfbs dot rwth-aachen dot de
2009-03-13 16:14 ` paolo dot carlini at oracle dot com
0 siblings, 2 replies; 3+ messages in thread
From: mrpugh at gmx dot de @ 2009-03-13 15:56 UTC (permalink / raw)
To: gcc-bugs
compiling the example code
*******(min_example.cpp)
#include <stdio.h>
template <int i>
class A
{
public:
template <typename T>
void print(int j)
{
printf("i: %i j: %i\n", i, j);
}
};
template <int j>
class B
{
public:
void print(A<j> *a)
{
a->print<int>(j);
}
};
int main()
{
A<23> *a = new A<23>();
B<23> b;
a->print<int>(5);
b.print(a);
return 0;
}
*******
with the command
>g++ min_example.cpp -o min_example
gives the error message
min_exmpl.cpp: In member function 'void B<j>::print(A<j>*)':
min_exmpl.cpp:20: error: expected primary-expression before 'int'
min_exmpl.cpp:20: error: expected `;' before 'int'
--
Summary: function template in template class cant be called from
other template class
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mrpugh at gmx dot de
GCC build triplet: x86_64 GNU/Linux
GCC host triplet: x86_64 GNU/Linux
GCC target triplet: x86_64 GNU/Linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39458
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/39458] function template in template class cant be called from other template class
2009-03-13 15:56 [Bug c++/39458] New: function template in template class cant be called from other template class mrpugh at gmx dot de
@ 2009-03-13 16:04 ` ruben at lfbs dot rwth-aachen dot de
2009-03-13 16:14 ` paolo dot carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: ruben at lfbs dot rwth-aachen dot de @ 2009-03-13 16:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from ruben at lfbs dot rwth-aachen dot de 2009-03-13 16:04 -------
Created an attachment (id=17459)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17459&action=view)
example code
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39458
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/39458] function template in template class cant be called from other template class
2009-03-13 15:56 [Bug c++/39458] New: function template in template class cant be called from other template class mrpugh at gmx dot de
2009-03-13 16:04 ` [Bug c++/39458] " ruben at lfbs dot rwth-aachen dot de
@ 2009-03-13 16:14 ` paolo dot carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-03-13 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo dot carlini at oracle dot com 2009-03-13 16:14 -------
Just use, correctly: a-> template print<int>(j);
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39458
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-13 16:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-13 15:56 [Bug c++/39458] New: function template in template class cant be called from other template class mrpugh at gmx dot de
2009-03-13 16:04 ` [Bug c++/39458] " ruben at lfbs dot rwth-aachen dot de
2009-03-13 16:14 ` paolo dot carlini at oracle dot com
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).