Hi,

apparently we have serious troubles with <cmath> and -std=c++11 and -fno-trapping-math because LTGT_EXPR is unhandled in potential_constant_expression_1. Thus, unless we have sound reasons to *not* handle it together with all the other *_EXPR, I think the below could safely go in mainline and 4_7-branch. Bootstrapped and tested x86_64-linux.

Ok?

Thanks,
Paolo.

///////////////////////////
gcc/cp
2012-05-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/53503
        * semantics.c (potential_constant_expression_1): Handle LTGT_EXPR.

libstdc++-v3
2012-05-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/53503
        * testsuite/26_numerics/headers/cmath/53503.cc: New.
Index: libstdc++-v3/testsuite/26_numerics/headers/cmath/53503.cc
===================================================================
--- libstdc++-v3/testsuite/26_numerics/headers/cmath/53503.cc   (revision 0)
+++ libstdc++-v3/testsuite/26_numerics/headers/cmath/53503.cc   (revision 0)
@@ -0,0 +1,21 @@
+// { dg-options "-std=gnu++11 -fno-trapping-math" }
+// { dg-do compile }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <cmath>
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c  (revision 187917)
+++ gcc/cp/semantics.c  (working copy)
@@ -8487,6 +8487,7 @@ potential_constant_expression_1 (tree t, bool want
     case UNGT_EXPR:
     case UNGE_EXPR:
     case UNEQ_EXPR:
+    case LTGT_EXPR:
     case RANGE_EXPR:
     case COMPLEX_EXPR:
       want_rval = true;

Reply via email to