except.c (build_noexcept_spec): Call cxx_constant_value after converting to bool.
authorJason Merrill <jason@redhat.com>
Mon, 28 Mar 2011 15:49:45 +0000 (11:49 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 28 Mar 2011 15:49:45 +0000 (11:49 -0400)
* except.c (build_noexcept_spec): Call cxx_constant_value after
converting to bool.

From-SVN: r171609

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C [new file with mode: 0644]

index 597093e03744dc785c6b2c284cc04d01e2b58816..3bbeddf8c64e6760f84fc65803d888daacc44eb6 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-28  Jason Merrill  <jason@redhat.com>
+
+       * except.c (build_noexcept_spec): Call cxx_constant_value after
+       converting to bool.
+
 2011-03-25  Kai Tietz  <ktietz@redhat.com>
 
        * lex.c (interface_strcmp): Handle dos-paths.
index c05e507574ce2c40197afce3013d579fcc4a5691..a814d67865853ca04803eb996d2bf36c74ec7545 100644 (file)
@@ -1203,10 +1203,10 @@ build_noexcept_spec (tree expr, int complain)
      it until instantiation.  */
   if (!processing_template_decl)
     {
-      expr = cxx_constant_value (expr);
       expr = perform_implicit_conversion_flags (boolean_type_node, expr,
                                                complain,
                                                LOOKUP_NORMAL);
+      expr = cxx_constant_value (expr);
     }
   if (expr == boolean_true_node)
     return noexcept_true_spec;
index 53424d290b56299821f9e17ea0331df9ffc24877..863f599458715487527ea90244a540eff09a5063 100644 (file)
@@ -1,3 +1,7 @@
+2011-03-28  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/constexpr-noexcept.C: New.
+
 2011-03-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR testsuite/48276
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C
new file mode 100644 (file)
index 0000000..7bf961b
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-options -std=c++0x }
+
+struct booleable {
+  bool data;
+  constexpr explicit operator bool() { return data; }
+};
+
+constexpr booleable truthy_func() { return {true}; }
+
+void funky() noexcept(truthy_func()) {}
+
+int main() {
+  funky();
+  return 0;
+}