blob: 4ee63b5d815cf1af2e2320bbf161b06a5f944493 [file] [log] [blame]
Richard Smith053f6c62014-05-16 23:01:30 +00001// RUN: rm -rf %t
2// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
3
4typedef struct A B;
5extern const int variable;
6extern constexpr int function();
7constexpr int test(bool b) { return b ? variable : function(); }
8
9namespace N {
10 typedef struct A B;
11 extern const int variable;
12 extern constexpr int function();
13}
14typedef N::B NB;
15constexpr int N_test(bool b) { return b ? N::variable : N::function(); }
16
17@import redecl_add_after_load_top;
18typedef C::A CB;
19constexpr int C_test(bool b) { return b ? C::variable : C::function(); }
20
21struct D {
22 struct A; // expected-note {{forward}}
23 static const int variable;
24 static constexpr int function(); // expected-note {{here}}
25};
26typedef D::A DB;
27constexpr int D_test(bool b) { return b ? D::variable : D::function(); } // expected-note {{subexpression}} expected-note {{undefined}}
28
29@import redecl_add_after_load;
30
31B tu_struct_test;
32constexpr int tu_variable_test = test(true);
33constexpr int tu_function_test = test(false);
34
35NB ns_struct_test;
36constexpr int ns_variable_test = N_test(true);
37constexpr int ns_function_test = N_test(false);
38
39CB struct_struct_test;
40constexpr int struct_variable_test = C_test(true);
41constexpr int struct_function_test = C_test(false);
42
43// FIXME: We should accept this, but we're currently too lazy when merging class
44// definitions to determine that the definitions in redecl_add_after_load are
45// definitions of these entities.
46DB merged_struct_struct_test; // expected-error {{incomplete}}
47constexpr int merged_struct_variable_test = D_test(true); // expected-error {{constant}} expected-note {{in call to}}
48constexpr int merged_struct_function_test = D_test(false); // expected-error {{constant}} expected-note {{in call to}}