When __typeof__ is applied to a conditional expression that contains a call to a const function it expands to a const type.
$ cat tgmath.c int foo (int) __attribute__ ((const)); void test (void) { __typeof__ (1 ? foo (0) : 0) texpr; texpr = 0; } $ gcc -c tgmath.c tgmath.c: In function ‘test’: tgmath.c:7:3: error: assignment of read-only variable ‘texpr’ -- Summary: [4.5 regression] __typeof__ expands to const type Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schwab at linux-m68k dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41476