if (check_for_bare_parameter_packs (condition))
condition = error_mark_node;
+ /* Save the condition in case it was a concept check. */
+ tree orig_condition = condition;
+
if (instantiation_dependent_expression_p (condition))
{
/* We're in a template; build a STATIC_ASSERT and put it in
the right place. */
- tree assertion;
-
- assertion = make_node (STATIC_ASSERT);
- STATIC_ASSERT_CONDITION (assertion) = condition;
+ defer:
+ tree assertion = make_node (STATIC_ASSERT);
+ STATIC_ASSERT_CONDITION (assertion) = orig_condition;
STATIC_ASSERT_MESSAGE (assertion) = message;
STATIC_ASSERT_SOURCE_LOCATION (assertion) = location;
return;
}
- /* Save the condition in case it was a concept check. */
- tree orig_condition = condition;
-
/* Fold the expression and convert it to a boolean value. */
condition = contextual_conv_bool (condition, complain);
condition = fold_non_dependent_expr (condition, complain,
if (integer_zerop (condition))
{
+ /* CWG2518: static_assert failure in a template is not IFNDR. */
+ if (processing_template_decl)
+ goto defer;
+
int sz = TREE_INT_CST_LOW (TYPE_SIZE_UNIT
(TREE_TYPE (TREE_TYPE (message))));
int len = TREE_STRING_LENGTH (message) / sz - 1;