| 1 |
// RUN: rm -rf %t |
| 2 |
// 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 |
| 3 |
// 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_DECLS |
| 4 |
|
| 5 |
// expected-no-diagnostics |
| 6 |
|
| 7 |
#ifdef IMPORT_DECLS |
| 8 |
@import redecl_add_after_load_decls; |
| 9 |
#else |
| 10 |
typedef struct A B; |
| 11 |
extern const int variable; |
| 12 |
extern constexpr int function(); |
| 13 |
constexpr int test(bool b) { return b ? variable : function(); } |
| 14 |
|
| 15 |
namespace N { |
| 16 |
typedef struct A B; |
| 17 |
extern const int variable; |
| 18 |
extern constexpr int function(); |
| 19 |
} |
| 20 |
typedef N::B NB; |
| 21 |
constexpr int N_test(bool b) { return b ? N::variable : N::function(); } |
| 22 |
|
| 23 |
@import redecl_add_after_load_top; |
| 24 |
typedef C::A CB; |
| 25 |
constexpr int C_test(bool b) { return b ? C::variable : C::function(); } |
| 26 |
|
| 27 |
struct D { |
| 28 |
struct A; |
| 29 |
static const int variable; |
| 30 |
static constexpr int function(); |
| 31 |
}; |
| 32 |
typedef D::A DB; |
| 33 |
constexpr int D_test(bool b) { return b ? D::variable : D::function(); } |
| 34 |
#endif |
| 35 |
|
| 36 |
@import redecl_add_after_load; |
| 37 |
|
| 38 |
B tu_struct_test; |
| 39 |
constexpr int tu_variable_test = test(true); |
| 40 |
constexpr int tu_function_test = test(false); |
| 41 |
|
| 42 |
NB ns_struct_test; |
| 43 |
constexpr int ns_variable_test = N_test(true); |
| 44 |
constexpr int ns_function_test = N_test(false); |
| 45 |
|
| 46 |
CB struct_struct_test; |
| 47 |
constexpr int struct_variable_test = C_test(true); |
| 48 |
constexpr int struct_function_test = C_test(false); |
| 49 |
|
| 50 |
DB merged_struct_struct_test; |
| 51 |
constexpr int merged_struct_variable_test = D_test(true); |
| 52 |
constexpr int merged_struct_function_test = D_test(false); |