xref: /aosp_15_r20/external/clang/test/Modules/merge-class-definition-visibility.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: rm -rf %t
2*67e74705SXin Li // RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \
3*67e74705SXin Li // RUN:            -I%S/Inputs/merge-class-definition-visibility \
4*67e74705SXin Li // RUN:            -fmodules-cache-path=%t %s -verify \
5*67e74705SXin Li // RUN:            -fmodules-local-submodule-visibility
6*67e74705SXin Li // expected-no-diagnostics
7*67e74705SXin Li 
8*67e74705SXin Li #include "c.h"
9*67e74705SXin Li template<typename T> struct X { T t; };
10*67e74705SXin Li typedef X<A> XA;
11*67e74705SXin Li struct B;
12*67e74705SXin Li 
13*67e74705SXin Li #include "e.h"
14*67e74705SXin Li // Ensure that this triggers the import of the second definition from e.h,
15*67e74705SXin Li // which is necessary to make the definition of A visible in the template
16*67e74705SXin Li // instantiation.
17*67e74705SXin Li XA xa;
18*67e74705SXin Li 
19*67e74705SXin Li // Ensure that we make the definition of B visible. We made the parse-merged
20*67e74705SXin Li // definition from e.h visible, which makes the definition from d.h visible,
21*67e74705SXin Li // and that definition was merged into the canonical definition from b.h,
22*67e74705SXin Li // so that becomes visible, and we have a visible definition.
23*67e74705SXin Li B b;
24