From 891d95cd0b09302f87fbbd6a3da8071a1b77f0f4 Mon Sep 17 00:00:00 2001 From: pk19604014 <95385881+pk19604014@users.noreply.github.com> Date: Thu, 21 Jul 2022 21:18:32 -0400 Subject: [PATCH] Made EqualityContext destructor virtual as the class has a virtual method + added -Wnon-virtual-dtor to catch similar cases in the future (#1411) --- bazel/cc_toolchains/clang_cc_toolchain_config.bzl | 1 + explorer/interpreter/value.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bazel/cc_toolchains/clang_cc_toolchain_config.bzl b/bazel/cc_toolchains/clang_cc_toolchain_config.bzl index 18697d1ee005..3fe9298b0e62 100644 --- a/bazel/cc_toolchains/clang_cc_toolchain_config.bzl +++ b/bazel/cc_toolchains/clang_cc_toolchain_config.bzl @@ -123,6 +123,7 @@ def _impl(ctx): "-Wself-assign", "-Wimplicit-fallthrough", "-Wctad-maybe-unsupported", + "-Wnon-virtual-dtor", # Unfortunately, LLVM isn't clean for this warning. "-Wno-unused-parameter", # Compile actions shouldn't link anything. diff --git a/explorer/interpreter/value.h b/explorer/interpreter/value.h index 5ac8331d5aee..2f626589e38d 100644 --- a/explorer/interpreter/value.h +++ b/explorer/interpreter/value.h @@ -126,7 +126,7 @@ class EqualityContext { -> bool = 0; protected: - ~EqualityContext() = default; + virtual ~EqualityContext() = default; }; auto TypeEqual(Nonnull t1, Nonnull t2,