This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33630] New: Error compiling template without instantiation
- From: "thomas at koeller dot dyndns dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Oct 2007 17:54:13 -0000
- Subject: [Bug c++/33630] New: Error compiling template without instantiation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code, when compiled, generates an error:
------------------------------------------------------
sarkovy:~> cat test.cc
template <typename T>
void x(void)
{
T::t x;
}
int
main(void)
{
return 0;
}
sarkovy:~> g++ test.cc
test.cc: In function 'void x()':
test.cc:4: error: expected `;' before 'x'
------------------------------------------------------
It is assumed that upon template instantiation type T defines 'T::t'.
Obviously, in the example the template is not instantiated at all. I expected
that in this case the template definition would be ignored by the compiler, but
that does not seem to be the case - is this correct?
--
Summary: Error compiling template without instantiation
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: thomas at koeller dot dyndns dot org
GCC build triplet: x86_64-pc-linux-gnu
GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33630