http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56977
--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> --- Inlining isn't relevant: __attribute__((__error__("error"))) void error (); void f (int i) { if (__builtin_constant_p (i)) { error (); } } fails the same way. But it doesn't fail with all uses of __builtin_constant_p: __attribute__((__error__("error"))) void error (); void f () { int g (); if (!__builtin_constant_p (1)) { error (); } if (__builtin_constant_p (g ())) { error (); } } compiles without any problems.