This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14571] New: Templates typedef:ed to a name still take template arguments.
- From: "d00freed at dtek dot chalmers dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Mar 2004 13:26:26 -0000
- Subject: [Bug c++/14571] New: Templates typedef:ed to a name still take template arguments.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++ --version gives "g++ (GCC) 3.3.3 (Debian 20040306)"
If you give a template with template given, and typdef it to a name, this new
name can still be used like a template! It can take template parameters that
replace those given in the typedef. The following code will print print out 0.1,
which shows that the vector now is of type vector<float> and not vector<int>.
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
typedef vector<int> intvector;
intvector<float> weird(1);
weird[0] = 0.1;
cerr << weird[0] << endl;
}
--
Summary: Templates typedef:ed to a name still take template
arguments.
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: d00freed at dtek dot chalmers dot se
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14571