#include <iostream> struct Outer { template<typename T> struct Inner { }; void f() { Inner<int> i1; Inner<double> i2; } }; int main() { Outer o; o.f(); } template<> struct Outer::Inner<double> { };
Standard input is empty
prog.cpp: In member function ‘void Outer::f()’:
prog.cpp:12:14: warning: unused variable ‘i1’ [-Wunused-variable]
Inner<int> i1;
^
prog.cpp:13:17: warning: unused variable ‘i2’ [-Wunused-variable]
Inner<double> i2;
^
prog.cpp: At global scope:
prog.cpp:24:15: error: specialization of ‘Outer::Inner<double>’ after instantiation
struct Outer::Inner<double>
^
prog.cpp:24:15: error: redefinition of ‘struct Outer::Inner<double>’
prog.cpp:6:9: error: previous definition of ‘struct Outer::Inner<double>’
struct Inner
^
Standard output is empty