[Bug c++/38377] __builtin_constant_p(t) ? t : 1 is not considered a constant integer expression

sabre at nondot dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 12 18:03:00 GMT 2008



------- Comment #6 from sabre at nondot dot org  2008-12-12 18:02 -------
Here are the testcases I checked in with the clang implementation of this if
you're interested:

// __builtin_constant_p as the condition of ?: allows arbitrary foldable
// constants to be transmogrified into i-c-e's.
char b[__builtin_constant_p((int)(1.0+2.0)) ? (int)(1.0+2.0) : -1];

struct c {
  int a : (  // expected-error {{expression is not an integer constant
expression}}
           __builtin_constant_p((int)(1.0+2.0)) ? (int)(1.0+
     expr  // expected-note {{subexpression not valid in an integer constant
expression}}
           ) : -1);
};


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38377



More information about the Gcc-bugs mailing list