This code: template<int i> class foo { public: typedef unsigned int unsigned_t; typedef signed int signed_t; };
template<typename T> class bar { public: typedef foo<8>::unsigned_t baz1; typedef foo<sizeof(T)>::unsigned_t baz2; }; bar<int> var; gets you this: ~/ootbc/personal/ivan$ c++ foo.cc foo.cc:16: error: type 'foo<sizeof (T)>' is not derived from type 'bar<T>' foo.cc:16: error: expected ';' before 'baz2' -- Summary: template accepting numeric fails with sizeof Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35228