[modules] When performing redeclaration lookup for a using declaration, prefer
UsingShadowDecls over other declarations of the same entity in the lookup
results. This ensures that we build correct redeclaration chains for the
UsingShadowDecls (otherwise we could see assertions and other misbehavior in
modules builds, when merging combines multiple redeclaration chains for the
same entity from the same module into one chain).
llvm-svn: 243592
diff --git a/clang/test/Modules/using-decl-redecl.cpp b/clang/test/Modules/using-decl-redecl.cpp
new file mode 100644
index 0000000..0e78cec
--- /dev/null
+++ b/clang/test/Modules/using-decl-redecl.cpp
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t \
+// RUN: -fmodule-map-file=%S/Inputs/using-decl-redecl/module.modulemap \
+// RUN: -I%S/Inputs/using-decl-redecl \
+// RUN: -verify %s
+#include "c.h"
+N::clstring y = b;
+
+// Use a typo to trigger import of all declarations in N.
+N::clstrinh s; // expected-error {{did you mean 'clstring'}}
+// expected-note@a.h:2 {{here}}