typeof() does not property recognizes the non-const type, which was casted from const type:
$ cat plik.c #include <stdio.h> int main() { const unsigned long val; typeof( ((unsigned long)(val)) ) val2; val2 = 0; //compilation error } $ gcc -o plik plik.c plik.c: In function âmainâ: plik.c:7: error: assignment of read-only variable âval2â $ gcc --version gcc (GCC) 4.4.3 20100127 (Red Hat 4.4.3-4) ... -- Summary: typeof with casting from const to non-const does not work properly Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: radoslaw dot biernacki at gmail dot com GCC build triplet: 4.4.3 20100127 (Red Hat 4.4.3-4) GCC host triplet: Linux TVBuildAlfa 2.6.32.12-115.fc12.i686.PAE #1 SMP http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45584