53 lines · cpp
1// RUN: rm -rf %t2// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++113// RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DIMPORT_DECLS4 5// expected-no-diagnostics6 7#ifdef IMPORT_DECLS8@import redecl_add_after_load_decls;9#else10typedef struct A B;11extern const int variable;12extern constexpr int function();13constexpr int test(bool b) { return b ? variable : function(); }14 15namespace N {16 typedef struct A B;17 extern const int variable;18 extern constexpr int function();19}20typedef N::B NB;21constexpr int N_test(bool b) { return b ? N::variable : N::function(); }22 23@import redecl_add_after_load_top;24typedef C::A CB;25constexpr int C_test(bool b) { return b ? C::variable : C::function(); }26 27struct D {28 struct A;29 static const int variable;30 static constexpr int function();31};32typedef D::A DB;33constexpr int D_test(bool b) { return b ? D::variable : D::function(); }34#endif35 36@import redecl_add_after_load;37 38B tu_struct_test;39constexpr int tu_variable_test = test(true);40constexpr int tu_function_test = test(false);41 42NB ns_struct_test;43constexpr int ns_variable_test = N_test(true);44constexpr int ns_function_test = N_test(false);45 46CB struct_struct_test;47constexpr int struct_variable_test = C_test(true);48constexpr int struct_function_test = C_test(false);49 50DB merged_struct_struct_test;51constexpr int merged_struct_variable_test = D_test(true);52constexpr int merged_struct_function_test = D_test(false);53