aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b705d6bba59..f6ad696c8f1 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -392,8 +392,11 @@ build_base_path (enum tree_code code,
if (null_test)
{
tree zero = cp_convert (TREE_TYPE (expr), nullptr_node, complain);
- null_test = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
- expr, zero);
+ null_test = build2_loc (input_location, NE_EXPR, boolean_type_node,
+ expr, zero);
+ /* This is a compiler generated comparison, don't emit
+ e.g. -Wnonnull-compare warning for it. */
+ TREE_NO_WARNING (null_test) = 1;
}
/* If this is a simple base reference, express it as a COMPONENT_REF. */