public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35727] New: Nested class of specialized template class bug
@ 2008-03-28 0:17 philippe at fornux dot com
2008-03-28 0:26 ` [Bug c++/35727] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: philippe at fornux dot com @ 2008-03-28 0:17 UTC (permalink / raw)
To: gcc-bugs
** I am trying to compile a program that looks like the following but the
compiler cannot recognize which class the nested class belongs to:
#include <iostream>
using namespace std;
template <typename T>
struct A
{
class B;
friend class B;
};
template <>
struct A<void>
{
class B;
friend class B;
};
template <typename T>
struct A<T>::B
{
B()
{
cout << __PRETTY_FUNCTION__ << endl;
}
};
int main()
{
A<void>::B b;
}
** Reports:
nesttempspecbug.cpp: In function `int main()':
nesttempspecbug.cpp:35: error: aggregate `A<void>::B b' has incomplete type and
cannot be defined
--
Summary: Nested class of specialized template class bug
Product: gcc
Version: 3.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: philippe at fornux dot com
GCC build triplet: gcc version 3.4.5 (mingw special)
GCC host triplet: Windows XP
GCC target triplet: MinGW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35727
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/35727] Nested class of specialized template class bug
2008-03-28 0:17 [Bug c++/35727] New: Nested class of specialized template class bug philippe at fornux dot com
@ 2008-03-28 0:26 ` pinskia at gcc dot gnu dot org
2008-03-28 5:21 ` philippe at fornux dot com
2008-12-29 4:07 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-28 0:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-03-28 00:25 -------
This error message is correct as you specialized A<void> but you also need to
specialize the nested class as the non specialized version of the nested
function will not be used.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35727
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/35727] Nested class of specialized template class bug
2008-03-28 0:17 [Bug c++/35727] New: Nested class of specialized template class bug philippe at fornux dot com
2008-03-28 0:26 ` [Bug c++/35727] " pinskia at gcc dot gnu dot org
@ 2008-03-28 5:21 ` philippe at fornux dot com
2008-12-29 4:07 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: philippe at fornux dot com @ 2008-03-28 5:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from philippe at fornux dot com 2008-03-28 05:20 -------
** Then if I add the following:
template <>
struct A<void>::B
{
B()
{
cout << __PRETTY_FUNCTION__ << endl;
}
};
** I get:
nesttempspecbug.cpp:35: error: explicit specialization of non-template
`A<void>::B'
nesttempspecbug.cpp:35: error: explicit specialization of non-template
`A<void>::B'
--
philippe at fornux dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35727
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/35727] Nested class of specialized template class bug
2008-03-28 0:17 [Bug c++/35727] New: Nested class of specialized template class bug philippe at fornux dot com
2008-03-28 0:26 ` [Bug c++/35727] " pinskia at gcc dot gnu dot org
2008-03-28 5:21 ` philippe at fornux dot com
@ 2008-12-29 4:07 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-29 4:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-12-29 04:06 -------
You just want:
struct A<void>::B
{
B()
{
cout << __PRETTY_FUNCTION__ << endl;
}
};
Since you already specialized A<void>, you don't need to specialize
A<void>::B.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35727
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-29 4:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-28 0:17 [Bug c++/35727] New: Nested class of specialized template class bug philippe at fornux dot com
2008-03-28 0:26 ` [Bug c++/35727] " pinskia at gcc dot gnu dot org
2008-03-28 5:21 ` philippe at fornux dot com
2008-12-29 4:07 ` 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).