================
@@ -0,0 +1,137 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: %clang_cc1 -std=c++20 -fmodules -fno-implicit-modules \
+// RUN:            -fmodules-local-submodule-visibility \
+// RUN:            -fmodule-map-file=module.modulemap \
+// RUN:            -fmodule-name=repro_module_a -emit-module \
+// RUN:            -fmodules-embed-all-files -x c++ module.modulemap \
+// RUN:            -o repro_module_a.pcm
+//
+// RUN: %clang_cc1 -std=c++20 -fmodules -fno-implicit-modules \
+// RUN:            -fmodules-local-submodule-visibility \
+// RUN:            -fmodule-map-file=module.modulemap \
+// RUN:            -fmodule-name=repro_wrapper_mock \
+// RUN:            -fmodule-file=repro_module_a=repro_module_a.pcm \
+// RUN:            -emit-module -fmodules-embed-all-files -x c++ 
module.modulemap \
+// RUN:            -o repro_wrapper_mock.pcm
+//
+// RUN: %clang_cc1 -std=c++20 -fmodules -fno-implicit-modules \
+// RUN:            -fmodules-local-submodule-visibility \
+// RUN:            -fmodule-map-file=module.modulemap \
+// RUN:            -fmodule-name=repro \
+// RUN:            -fmodule-file=repro_module_a=repro_module_a.pcm \
+// RUN:            -fmodule-file=repro_wrapper_mock=repro_wrapper_mock.pcm \
+// RUN:            -fsyntax-only repro_main.cpp
+
+//--- module.modulemap
+module TemplateClassModule {
+  textual header "template_class.h"
+}
+module repro_module_a {
+  header "module_a.h"
+  export *
+  use TemplateClassModule
+}
+module repro_wrapper_mock {
+  header "repro_wrapper.h"
+  export *
+  use repro_module_a
+  use TemplateClassModule
+}
+module repro {
+  export *
+  use repro_wrapper_mock
+}
+
+//--- template_class.h
+#ifndef TEMPLATE_CLASS_H_
+#define TEMPLATE_CLASS_H_
+namespace std {
+template <typename T>
+T&& move(T& t) noexcept { return static_cast<T&&>(t); }
+}
+
+enum class MyEnum { kValue1, kValue2 };
+inline MyEnum GetLocalValue() { return MyEnum::kValue2; }
+
+struct Pair { MyEnum first; MyEnum second; };
+inline Pair GetLocalPair() { return Pair{MyEnum::kValue1, MyEnum::kValue2}; }
+
+template <typename T>
+struct Consumer {
+  template <typename U>
+  void operator()(const U& x) const {}
+};
+
+template <typename F>
+struct Holder {
+  F f;
+  explicit Holder(F f) : f(std::move(f)) {}
+  void call() const { f(0); }
+};
+
+template <typename F>
+auto make_holder(F f) {
+  return Holder<F>(std::move(f));
+}
+
+template <typename T>
+class TemplateClass {
+ public:
+  template <typename... Args>
+  explicit TemplateClass(Args&&... args) {
----------------
jyknight wrote:

Replacing this template fn with a decl, `explicit TemplateClass(Args&&... 
args);` and moving the definition out-of-line below the class, 
```
template <typename T>
template <typename... Args>
TemplateClass<T>::TemplateClass(Args&&... args) {
  [...snip...]
}
```
demonstrates the issue mentioned above.

https://github.com/llvm/llvm-project/pull/202248
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to