summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp4
-rw-r--r--clang/test/Modules/Inputs/PR27890/a.h9
-rw-r--r--clang/test/Modules/Inputs/PR27890/module.modulemap1
-rw-r--r--clang/test/Modules/pr27890.cpp9
4 files changed, 19 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 0c9264f4032..30b4a3ebe2e 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5654,10 +5654,6 @@ static bool isImportedDeclContext(ASTReader *Chain, const Decl *D) {
if (D->isFromASTFile())
return true;
- // If we've not loaded any modules, this can't be imported.
- if (!Chain || !Chain->getModuleManager().size())
- return false;
-
// The predefined __va_list_tag struct is imported if we imported any decls.
// FIXME: This is a gross hack.
return D == D->getASTContext().getVaListTagDecl();
diff --git a/clang/test/Modules/Inputs/PR27890/a.h b/clang/test/Modules/Inputs/PR27890/a.h
new file mode 100644
index 00000000000..9c6e5621160
--- /dev/null
+++ b/clang/test/Modules/Inputs/PR27890/a.h
@@ -0,0 +1,9 @@
+template <class DataType> DataType values(DataType) { __builtin_va_list ValueArgs; return DataType(); }
+
+template <class DataType>
+class opt {
+public:
+ template <class Mods>
+ opt(Mods) {}
+};
+
diff --git a/clang/test/Modules/Inputs/PR27890/module.modulemap b/clang/test/Modules/Inputs/PR27890/module.modulemap
new file mode 100644
index 00000000000..85074e80789
--- /dev/null
+++ b/clang/test/Modules/Inputs/PR27890/module.modulemap
@@ -0,0 +1 @@
+module A { header "a.h" export * }
diff --git a/clang/test/Modules/pr27890.cpp b/clang/test/Modules/pr27890.cpp
new file mode 100644
index 00000000000..8bb9a9fd5c9
--- /dev/null
+++ b/clang/test/Modules/pr27890.cpp
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR27890 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR27890/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR27890 -verify %s
+
+#include "a.h"
+enum ActionType {};
+opt<ActionType> a(values(""));
+
+// expected-no-diagnostics \ No newline at end of file
OpenPOWER on IntegriCloud