Ver Fonte

Made EqualityContext destructor virtual as the class has a virtual method + added -Wnon-virtual-dtor to catch similar cases in the future (#1411)

pk19604014 há 3 anos atrás
pai
commit
891d95cd0b

+ 1 - 0
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.

+ 1 - 1
explorer/interpreter/value.h

@@ -126,7 +126,7 @@ class EqualityContext {
       -> bool = 0;
 
  protected:
-  ~EqualityContext() = default;
+  virtual ~EqualityContext() = default;
 };
 
 auto TypeEqual(Nonnull<const Value*> t1, Nonnull<const Value*> t2,