--- /dev/null
+struct X { union { int n; }; };
+inline int a(X x) { return x.n; }
--- /dev/null
+struct X { union { int n; }; };
+inline int b(X x) { return x.n; }
--- /dev/null
+#include "a.h"
+#include "b.h"
--- /dev/null
+struct X { union { int n; }; };
+inline int c(X x) { return x.n; }
--- /dev/null
+module a { header "a.h" }
+module b { header "b.h" }
+module c {
+ module c1 { header "c1.h" }
+ module c2 { header "c2.h" }
+}
--- /dev/null
+namespace NS {
+ struct X {};
+}
--- /dev/null
+module hidden {
+ header "visible.h"
+ explicit module sub { header "hidden.h" }
+}
--- /dev/null
+// hidden-names/visible.h
+namespace NS {}
--- /dev/null
+struct X {
+ virtual void f();
+};
+inline void X::f() {}
--- /dev/null
+module m {
+ module a { header "a.h" }
+ module b { header "b.h" }
+}
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-local-submodule-visibility \
+// RUN: -fmodule-map-file=%S/Inputs/anon-redecl/module.modulemap \
+// RUN: -I%S/Inputs/anon-redecl \
+// RUN: -verify -std=c++11 %s
+
+#include "a.h"
+#include "b.h"
+#include "c1.h"
+#include "c2.h"
+
+// expected-no-diagnostics
+int x = a({});
+int y = b({});
+int z = c({});
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/hidden-names %s -verify
+// expected-no-diagnostics
+
+#include "visible.h"
+
+using namespace NS;
+
+namespace {
+ struct X { void f(); };
+}
+
+void X::f() {}
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -I%S/Inputs/merge-function-defs -fmodules -fmodule-map-file=%S/Inputs/merge-function-defs/map -fmodules-cache-path=%t %s -emit-llvm-only
+
+#include "b.h"
+
+struct X {
+ virtual void f();
+};
+inline void X::f() {}
+
+X x;