@@ -1316,15 +1316,18 @@ build_noexcept_spec (tree expr, int comp
LOOKUP_NORMAL);
expr = cxx_constant_value (expr);
}
- if (expr == boolean_true_node)
- return noexcept_true_spec;
- else if (expr == boolean_false_node)
- return noexcept_false_spec;
- else if (expr == error_mark_node)
+ if (TREE_CODE (expr) == INTEGER_CST)
+ {
+ if (operand_equal_p (expr, boolean_true_node, 0))
+ return noexcept_true_spec;
+ else if (operand_equal_p (expr, boolean_false_node, 0))
+ return noexcept_false_spec;
+ }
+ if (expr == error_mark_node)
return error_mark_node;
else
{
- gcc_assert (processing_template_decl || expr == error_mark_node
+ gcc_assert (processing_template_decl
|| TREE_CODE (expr) == DEFERRED_NOEXCEPT);
return build_tree_list (expr, NULL_TREE);
}
@@ -10840,8 +10840,14 @@ tsubst_exception_specification (tree fnt
{
/* A noexcept-specifier. */
tree expr = TREE_PURPOSE (specs);
- if (expr == boolean_true_node || expr == boolean_false_node)
- new_specs = expr;
+ if (TREE_CODE (expr) == INTEGER_CST)
+ {
+ if (operand_equal_p (expr, boolean_true_node, 0)
+ || operand_equal_p (expr, boolean_false_node, 0))
+ new_specs = expr;
+ }
+ if (new_specs != NULL_TREE)
+ ;
else if (defer_ok)
{
/* Defer instantiation of noexcept-specifiers to avoid
@@ -1871,7 +1871,7 @@ merge_exception_specifiers (tree list, t
/* If ADD is a deferred noexcept, we must have been called from
process_subob_fn. For implicitly declared functions, we build up
a list of functions to consider at instantiation time. */
- if (noex == boolean_true_node)
+ if (operand_equal_p (noex, boolean_true_node, 0))
noex = NULL_TREE;
gcc_assert (fn && (!noex || is_overloaded_fn (noex)));
noex = build_overload (fn, noex);
@@ -0,0 +1,11 @@
+// PR c++/54207
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+typedef bool B;
+constexpr B foo () { return true; }
+
+void
+bar () noexcept (foo ())
+{
+}