public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13825] New: template instantiation fails due to substituting the wrong type for a parameter
@ 2004-01-23 5:08 mps at sonartech dot com dot au
2004-01-23 5:28 ` [Bug c++/13825] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: mps at sonartech dot com dot au @ 2004-01-23 5:08 UTC (permalink / raw)
To: gcc-bugs
The following code is correct, I think, but gcc 3.3.2 rejects it.
Its messages say it's doing an instantiation with B_PARAM=int.
I think that's it's mistake.
template <typename A_PARAM>
struct A {};
template <typename B_PARAM>
struct B {
template <typename B1_PARAM>
struct B1 {
B1 (B_PARAM);
};
};
template <typename C_PARAM>
struct C {
typedef A <C_PARAM> a_t;
typename B <a_t>::B1 <a_t> _b1;
C () : _b1 (a_t ()) {}
};
int
main ()
{
C <int> c;
}
--
Summary: template instantiation fails due to substituting the
wrong type for a parameter
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mps at sonartech dot com dot au
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: What's a triplet anyway?
GCC host triplet: Intel Debian Linux 2.4.22
GCC target triplet: Not cross-compiling
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13825
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/13825] template instantiation fails due to substituting the wrong type for a parameter
2004-01-23 5:08 [Bug c++/13825] New: template instantiation fails due to substituting the wrong type for a parameter mps at sonartech dot com dot au
@ 2004-01-23 5:28 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-23 5:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-23 05:28 -------
No the code is invalid, yes the error message sucks but that has been fixed for 3.4:
input.cc:16: error: non-template `B1' used as template
input.cc:16: error: (use `B >::template B1' to indicate that it is a template)
input.cc:16: error: declaration does not declare anything
input.cc: In constructor `C::C()':
input.cc:18: error: class `C' does not have any field named `_b1'
Basically this line:
typename B <a_t>::B1 <a_t> _b1;
should be:
typename B <a_t>::template B1 <a_t> _b1;
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13825
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-23 5:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-23 5:08 [Bug c++/13825] New: template instantiation fails due to substituting the wrong type for a parameter mps at sonartech dot com dot au
2004-01-23 5:28 ` [Bug c++/13825] " 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).