@import redecl_add_after_load_top;
typedef C::A CB;
constexpr int C_test(bool b) { return b ? C::variable : C::function(); }

struct D {
  struct A;
  static const int variable;
  static constexpr int function();
};
typedef D::A DB;
constexpr int D_test(bool b) { return b ? D::variable : D::function(); }
#endif

@import redecl_add_after_load;

B tu_struct_test;
constexpr int tu_variable_test = test(true);
constexpr int tu_function_test = test(false);

NB ns_struct_test;
constexpr int ns_variable_test = N_test(true);
constexpr int ns_function_test = N_test(false);

CB struct_struct_test;
constexpr int struct_variable_test = C_test(true);
constexpr int struct_function_test = C_test(false);

DB merged_struct_struct_test;
constexpr int merged_struct_variable_test = D_test(true);
constexpr int merged_struct_function_test = D_test(false);
Beispiel #2
0
constexpr int C_test(bool b) { return b ? C::variable : C::function(); }

struct D {
  struct A; // expected-note {{forward}}
  static const int variable;
  static constexpr int function(); // expected-note {{here}}
};
typedef D::A DB;
constexpr int D_test(bool b) { return b ? D::variable : D::function(); } // expected-note {{subexpression}} expected-note {{undefined}}

@import redecl_add_after_load;

B tu_struct_test;
constexpr int tu_variable_test = test(true);
constexpr int tu_function_test = test(false);

NB ns_struct_test;
constexpr int ns_variable_test = N_test(true);
constexpr int ns_function_test = N_test(false);

CB struct_struct_test;
constexpr int struct_variable_test = C_test(true);
constexpr int struct_function_test = C_test(false);

// FIXME: We should accept this, but we're currently too lazy when merging class
// definitions to determine that the definitions in redecl_add_after_load are
// definitions of these entities.
DB merged_struct_struct_test; // expected-error {{incomplete}}
constexpr int merged_struct_variable_test = D_test(true); // expected-error {{constant}} expected-note {{in call to}}
constexpr int merged_struct_function_test = D_test(false); // expected-error {{constant}} expected-note {{in call to}}