clang: Add test for -Wunreachable-code + weak redeclaration
authorNico Weber <thakis@chromium.org>
Fri, 4 Sep 2020 14:26:46 +0000 (10:26 -0400)
committerNico Weber <thakis@chromium.org>
Fri, 4 Sep 2020 14:35:50 +0000 (10:35 -0400)
This tests what caused the revert in 7b033238.

clang/test/SemaCXX/unreachable-code.cpp

index fd006c0..0dfc3d5 100644 (file)
@@ -68,3 +68,12 @@ int pr6130(unsigned i) {
       throw PR6130(); // no-warning
   }
 }
+
+extern "C" void foo(void);
+extern "C" __attribute__((weak)) decltype(foo) foo;
+
+void weak_redecl() {
+  if (foo)
+    return;
+  bar(); // no-warning
+}