[clang] 2a03f27 - clang: Add test for -Wunreachable-code + weak redeclaration

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 07:36:05 PDT 2020


Author: Nico Weber
Date: 2020-09-04T10:35:50-04:00
New Revision: 2a03f270d69cf1079feb029f84727288e217588a

URL: https://github.com/llvm/llvm-project/commit/2a03f270d69cf1079feb029f84727288e217588a
DIFF: https://github.com/llvm/llvm-project/commit/2a03f270d69cf1079feb029f84727288e217588a.diff

LOG: clang: Add test for -Wunreachable-code + weak redeclaration

This tests what caused the revert in 7b033238.

Added: 
    

Modified: 
    clang/test/SemaCXX/unreachable-code.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/SemaCXX/unreachable-code.cpp b/clang/test/SemaCXX/unreachable-code.cpp
index fd006c099e7d..0dfc3d5744fb 100644
--- a/clang/test/SemaCXX/unreachable-code.cpp
+++ b/clang/test/SemaCXX/unreachable-code.cpp
@@ -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
+}


        


More information about the cfe-commits mailing list