summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/redecl-add-after-load.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-05-19 20:59:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-05-19 20:59:20 +0000
commit851072efb735dcd66d1fbfaa434c2c9d7708e29a (patch)
treecfc7e71519d6586be724be73cee0593f7790fb6a /clang/test/Modules/redecl-add-after-load.cpp
parentcb172b104a6ae03001dfc5a2971efc49cef083ab (diff)
downloadbcm5719-llvm-851072efb735dcd66d1fbfaa434c2c9d7708e29a.tar.gz
bcm5719-llvm-851072efb735dcd66d1fbfaa434c2c9d7708e29a.zip
If two sibling modules declare the same entity, and we indirectly pull a
declaration of that entity in from one of those modules, keep track of the fact that we've not completed the redeclaration chain yet so that we can pull the remaining declarations in from the other module if they're needed. llvm-svn: 209161
Diffstat (limited to 'clang/test/Modules/redecl-add-after-load.cpp')
-rw-r--r--clang/test/Modules/redecl-add-after-load.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/test/Modules/redecl-add-after-load.cpp b/clang/test/Modules/redecl-add-after-load.cpp
index 4ee63b5d815..68deaf8b4ef 100644
--- a/clang/test/Modules/redecl-add-after-load.cpp
+++ b/clang/test/Modules/redecl-add-after-load.cpp
@@ -1,6 +1,11 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 -DIMPORT_DECLS
+#ifdef IMPORT_DECLS
+// expected-no-diagnostics
+@import redecl_add_after_load_decls;
+#else
typedef struct A B;
extern const int variable;
extern constexpr int function();
@@ -25,6 +30,7 @@ struct D {
};
typedef D::A DB;
constexpr int D_test(bool b) { return b ? D::variable : D::function(); } // expected-note {{subexpression}} expected-note {{undefined}}
+#endif
@import redecl_add_after_load;
@@ -43,6 +49,11 @@ 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}}
+DB merged_struct_struct_test;
+constexpr int merged_struct_variable_test = D_test(true);
+constexpr int merged_struct_function_test = D_test(false);
+#ifndef IMPORT_DECLS
+// expected-error@-4 {{incomplete}}
+// expected-error@-4 {{constant}} expected-note@-4 {{in call to}}
+// expected-error@-4 {{constant}} expected-note@-4 {{in call to}}
+#endif
OpenPOWER on IntegriCloud