public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19628] New: g++ no longer accepts __builtin_constant_p in constant-expressions
@ 2005-01-25 20:33 austern at apple dot com
  2005-01-25 20:44 ` [Bug c++/19628] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: austern at apple dot com @ 2005-01-25 20:33 UTC (permalink / raw)
  To: gcc-bugs

The following test case is accepted by 3.3 (both C and C++) and by 4.0 C, but not by 4.0 C++.
#define FOO(x) (__builtin_constant_p(x) ? 1 : 2)

int foo(int n) {
  switch(n) {
  case FOO(3):
    return 1;
  default:
    return 2;
  }
}

Was this change intentional?  Even if it was, the C/C++ incompatibility is unfortunate.  This sort of 
construct is likely to appear in headers used by both languages.  (And we can't very well point to 
language standards in deciding whether __builtin_constant_p should be considered a constant-
expression, since it's a GNU extension.)

-- 
           Summary: g++ no longer accepts __builtin_constant_p in constant-
                    expressions
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: austern at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.7.0
  GCC host triplet: powerpc-apple-darwin7.7.0
GCC target triplet: powerpc-apple-darwin7.7.0


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-05-19 17:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 20:33 [Bug c++/19628] New: g++ no longer accepts __builtin_constant_p in constant-expressions austern at apple dot com
2005-01-25 20:44 ` [Bug c++/19628] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2005-01-28 20:17 ` austern at apple dot com
2005-01-29 17:32 ` pinskia at gcc dot gnu dot org
2005-01-30 19:56 ` pinskia at gcc dot gnu dot org
2005-01-31  1:39 ` mmitchel at gcc dot gnu dot org
2005-01-31  2:38 ` austern at apple dot com
2005-05-19 17:24 ` [Bug c++/19628] [3.4 " mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).