Example below prints 4, should be 1. If #pragma pack() is removed it prints 1, also it prints 1 if the printing line is also wrapped in pragmas. If instead template stuff is removed at all it prints 1 correctly.
--example-- #include <iostream> using namespace std; template<typename C> struct Z { #pragma pack(1) union Packed { struct { int dx:2; int dy:2; }; unsigned char byte; }; #pragma pack() }; main() { Z<int>::Packed x; cout << sizeof(x) << endl; } -- Summary: #pragma(1) doesn't work on the inner classes inside the temlated class Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: yuri at tsoft dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21560