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