2015-11-25 Jason Merrill <jason@redhat.com>
+ * lambda.c (maybe_add_lambda_conv_op): Only set
+ no_sanitize_undefined if SANITIZE_NULL.
+
PR c++/67941
* lambda.c (maybe_add_lambda_conv_op): Mark _FUN as
no_sanitize_undefined.
if (generic_lambda_p)
fn = add_inherited_template_parms (fn, DECL_TI_TEMPLATE (callop));
- /* Don't UBsan this function; we're deliberately calling op() with a null
- object argument. */
- tree attrs = build_tree_list (get_identifier ("no_sanitize_undefined"),
- NULL_TREE);
- cplus_decl_attributes (&fn, attrs, 0);
+ if (flag_sanitize & SANITIZE_NULL)
+ {
+ /* Don't UBsan this function; we're deliberately calling op() with a null
+ object argument. */
+ tree attrs = build_tree_list (get_identifier ("no_sanitize_undefined"),
+ NULL_TREE);
+ cplus_decl_attributes (&fn, attrs, 0);
+ }
add_method (type, fn, NULL_TREE);